an opencl binding - zcl/panama

Michael Zucchi notzed at gmail.com
Mon Jan 27 00:06:21 UTC 2020


On 26/1/20 3:22 pm, Michael Zucchi wrote:
> The unique-ness is required where the objects have some java state 
> they need to maintain.  I seem to recall I really needed this 
> somewhere and couldn't always just rely on keeping track of the 
> original object, but it might have just been a convenience.  It could 
> probably just keep the weakreference instead of the MemoryAddress as 
> it's 'pointer' and that would also protect against some use-after-free 
> of the original object.
>
> I'm curious, I might try a hashtable-free version. 

Just for interests sake I did try, and it wasn't a winner.

Currently CLEvent looks up the CLContext, which looks up the CLDevice so 
it can get the CLPlatform ... so it can't find out the api version.

So in that case the no-hash version is around 80% slower.

If I remove this initialisation step, then the hash-table version is 
only about 7% slower because the CLContext caches the platform and version.

For comparison a completely non-gc version that requires explicit 
release is about 50% faster in the same no-initialisation state.

It's not very representative benchmark but I suppose it's a worst-case 
overhead.  I think i'll keep the hashtable version for now.

  Michael



More information about the panama-dev mailing list