C++ array wrapper re-creating(and computing) in loop throws error(CL_INVALID_MEM_OBJECT) but works for prepared N-array of C++ arrays
Closed this issue · 0 comments
Found the root: re-creating inside loop has a chance to get same pointer (C++ - OS memory management) so USE_HOST_PTR flagged buffer throws error because of using duplicate buffer objects with same pointer.
Todo: release buffer that is bound to hashcode of ClArray<T>
that is being destructed, in the Cores/ClNumberCruncher
-
because C# generates probably same hash after some iterations, makes API use same opencl buffer with USE_HOST_PTR flag and that has old/deleted array pointer, needs to re-check for USE_HOST_PTR type buffers whenever accessed.
or -
Parallel.For and buffer read/write(or workers[i].kernelArgument) gets overlapped(or even out of bounds) addressings that throw AggregateException_ctor_DefaultMessage error + System.AccessViolationException
-
no problem for C# arrays
-
probably from the USE_HOST_PTR buffer allocation failure which is not yet error-checked yet.
-
or, it is opencl implementation bugging when deleting a pointer while that pointer is still in an opencl buffer as CL_MEM_USE_HOST_PTR