Since I don't have a suitable implementation nothing is tested and there's probably some typos and so on. I found a few small bugs in the enum tables while I was there.
But what took most of the time was the property queries. Each OpenCL object type has one or more query functions but rather than implement them all I use a tagged query function which branches to the correct function entry point at the lowest level but shares all the rest of the code. But then I had to add some specialist variants, and specialisations for return types and overloaded parameters - it started to get unwieldy and a new query type on CLKernel meant it wasn't going to be enough anyway.
So I said fuck that for a joke and just redid the whole mechanism.
For the basic 5-parameter queries I still share most of the code but I now add any type-specific queries separately. To cope with the api and code bloat i distilled the java side interface down to only two entry points for each query:
native <T> T getInfoAny(int type, int ctype, int param_name); native <T> T getInfoAnyV(int type, int ctype, int param_name);
The first is a scalar query and the second an array one. It just means it now has to box primitive return types for scalar queries which is unlikely to have any measurable performance impact but the Java helpers which wrap the above interfaces in type-friendly calls could always be replaced with native equivalents if it was an issue.
This let me merge some internal jni code and delete a lot of snot and I moved the re-usability to a different layer so that the more specific queries can share most of the code. For example this was the previous set of native interfaces on CLObject, and although this covered the kernel and program specific 6-argument queries like GetProgramBuildInfo() it was getting a bit messy.
native long getInfoLong(int type, long subtarget, int param); native long[] getInfoLongA(int type, long subtarget, int param); native int getInfoInt(int type, long subtarget, int param); native byte[] getInfoByteA(int type, long subtarget, int param); native <T> T getInfoP(int type, long subtarget, int param, int ctype); native <T extends CLObject> T[] getInfoPA(int type, long subtarget, int param, int ctype); native long getInfoSizeT(int type, long subtarget, int param); native long[] getInfoSizeTA(int type, long subtarget, int param);
... It seemed like a good idea at the time.
The exposed interfaces remain the same (like getInfoString(param), getInfoInt(param), etc).
Given the complete lack of interest and because it needs some testing anyway I wont be releasing a zcl-0.6 just yet.
No comments:
Post a Comment