aparapi
aparapi copied to clipboard
vector feature
@freemo Here vector feature "proof of concept".
Right now, VectorTest generate valid OpenCL code but fail to execute because of !!!!!!! clCreateBuffer failed invalid buffer size. If I understand it right, something should be changed at JNI code to create correct buffer for vector array. @freemo, will you able to help with it?
Codecov Report
Merging #71 into master will decrease coverage by
0.17%. The diff coverage is26.66%.
@@ Coverage Diff @@
## master #71 +/- ##
============================================
- Coverage 46.93% 46.75% -0.18%
- Complexity 849 856 +7
============================================
Files 57 58 +1
Lines 9386 9460 +74
Branches 1527 1547 +20
============================================
+ Hits 4405 4423 +18
- Misses 4538 4589 +51
- Partials 443 448 +5
Any idea where in the native code this needs to change. I'll look around and see if I can't figure out what change is needed but I'm not sure off hand where that might be. I can currently get the code compiled for the various systems once we identify a solution. I poke around today and see if anything sticks out
On Oct 23, 2017 3:40 AM, "Codecov" [email protected] wrote:
Codecov https://codecov.io/gh/Syncleus/aparapi/pull/71?src=pr&el=h1 Report
Merging #71 https://codecov.io/gh/Syncleus/aparapi/pull/71?src=pr&el=desc into master https://codecov.io/gh/Syncleus/aparapi/commit/84e6cd15c9178f5a4a3afff11f6f5622199dd421?src=pr&el=desc will decrease coverage by 0.03%. The diff coverage is 48.97%.
@@ Coverage Diff @@## master #71 +/- ## ============================================- Coverage 46.93% 46.89% -0.04% - Complexity 849 856 +7
Files 57 58 +1 Lines 9386 9431 +45 Branches 1527 1537 +10 ============================================+ Hits 4405 4423 +18 - Misses 4538 4560 +22 - Partials 443 448 +5
— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/Syncleus/aparapi/pull/71#issuecomment-338573445, or mute the thread https://github.com/notifications/unsubscribe-auth/AC5JAv71SZ4JV_qH8M1i-ddDY8U4ymYKks5svEMHgaJpZM4QCZ-g .
@shabanovd ok so I tracked down the change (I think) to this line:
https://github.com/Syncleus/aparapi-native/blob/b7473d1f8a00284b56dfe7ec1185f70e9a1eedb6/src/cpp/invoke/OpenCLMem.cpp#L5
The issue is figuring out how to change it for an array of primitives and vectors at the same time.
@shabanovd and the bits size seems to get set here:
https://github.com/Syncleus/aparapi-native/blob/29a057b0b231215986abcc97cda02b2aa66e5383/src/cpp/invoke/OpenCLJNI.cpp#L159
@shabanovd then the argDefs themself seem to come from here:
https://github.com/Syncleus/aparapi-native/blob/29a057b0b231215986abcc97cda02b2aa66e5383/src/cpp/invoke/OpenCLJNI.cpp#L322
Which is ultimately determined from here:
https://github.com/Syncleus/aparapi-native/blob/b7473d1f8a00284b56dfe7ec1185f70e9a1eedb6/src/cpp/invoke/OpenCLKernel.h#L25
@freemo think that it end up in adjusting OpenCLMem::getPrimitiveSizeInBytes by something like:
...
jsize vectorFactor = 1;
if (argisset(argBits, VECTOR2) {
vectorFactor = 2;
} else if (argisset(argBits, VECTOR3) {
vectorFactor = 3;
} else ...
return(sizeInBytes * vectorFactor);
Does that make sense?
@shabanovd yea that makes sense. I will give it a try and see if it passes tests. You have all the unit tests in your PR I can test against i assume?
@freemo yes, use this test
@shabanovd wonderful thanks. I'll edit the native code this evening and run the tests. If it works ill check it in. BTW if you feel compelled to do it yourself we also have aparapi-vagrant which brings up a vagrant environment with AMD APP SDK installed and all the build tools so you can built linux x63 and x32 binaries. The native project also should compile as-is under OSX just fine... windows is still a bit of a PITA to compile though.
@shabanovd with your suggested edits to aparapi-native the compilation fails with the following results:
ibtool: compile: g++ -DPACKAGE_NAME=\"libaparapi\" -DPACKAGE_TARNAME=\"libaparapi\" -DPACKAGE_VERSION=\"1.2.1\" "-DPACKAGE_STRING=\"libaparapi 1.2.1\"" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"libaparapi\" -DVERSION=\"1.2.1\" -I. -Iinclude -I/opt/AMDAPP/SDK/include -Isrc/cpp -Isrc/cpp/runKernel -Isrc/cpp/invoke -I/usr/lib/jvm/java-8-openjdk/include -I/usr/lib/jvm/java-8-openjdk/include/linux -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -g -O2 -MT src/cpp/invoke/libaparapi_la-OpenCLArgDescriptor.lo -MD -MP -MF src/cpp/invoke/.deps/libaparapi_la-OpenCLArgDescriptor.Tpo -c src/cpp/invoke/OpenCLArgDescriptor.cpp -fno-common -DPIC -o src/cpp/invoke/.libs/libaparapi_la-OpenCLArgDescriptor.o
mv -f src/cpp/invoke/.deps/libaparapi_la-OpenCLArgDescriptor.Tpo src/cpp/invoke/.deps/libaparapi_la-OpenCLArgDescriptor.Plo
/bin/sh ./libtool --tag=CXX --mode=compile g++ -DPACKAGE_NAME=\"libaparapi\" -DPACKAGE_TARNAME=\"libaparapi\" -DPACKAGE_VERSION=\"1.2.1\" -DPACKAGE_STRING=\"libaparapi\ 1.2.1\" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"libaparapi\" -DVERSION=\"1.2.1\" -I. -Iinclude -I/opt/AMDAPP/SDK/include -Isrc/cpp -Isrc/cpp/runKernel -Isrc/cpp/invoke -I/usr/lib/jvm/java-8-openjdk/include -I/usr/lib/jvm/java-8-openjdk/include/linux -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -g -O2 -MT src/cpp/invoke/libaparapi_la-OpenCLMem.lo -MD -MP -MF src/cpp/invoke/.deps/libaparapi_la-OpenCLMem.Tpo -c -o src/cpp/invoke/libaparapi_la-OpenCLMem.lo `test -f 'src/cpp/invoke/OpenCLMem.cpp' || echo './'`src/cpp/invoke/OpenCLMem.cpp
libtool: compile: g++ -DPACKAGE_NAME=\"libaparapi\" -DPACKAGE_TARNAME=\"libaparapi\" -DPACKAGE_VERSION=\"1.2.1\" "-DPACKAGE_STRING=\"libaparapi 1.2.1\"" -DPACKAGE_BUGREPORT=\"[email protected]\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DHAVE_DLFCN_H=1 -DLT_OBJDIR=\".libs/\" -DPACKAGE=\"libaparapi\" -DVERSION=\"1.2.1\" -I. -Iinclude -I/opt/AMDAPP/SDK/include -Isrc/cpp -Isrc/cpp/runKernel -Isrc/cpp/invoke -I/usr/lib/jvm/java-8-openjdk/include -I/usr/lib/jvm/java-8-openjdk/include/linux -I/usr/lib/jvm/java-8-openjdk-amd64/include -I/usr/lib/jvm/java-8-openjdk-amd64/include/linux -I/usr/lib/jvm/java-8-oracle/include -I/usr/lib/jvm/java-8-oracle/include/linux -I/System/Library/Frameworks/JavaVM.framework/Versions/Current/Headers/ -DCL_USE_DEPRECATED_OPENCL_1_1_APIS -g -O2 -MT src/cpp/invoke/libaparapi_la-OpenCLMem.lo -MD -MP -MF src/cpp/invoke/.deps/libaparapi_la-OpenCLMem.Tpo -c src/cpp/invoke/OpenCLMem.cpp -fno-common -DPIC -o src/cpp/invoke/.libs/libaparapi_la-OpenCLMem.o
src/cpp/invoke/OpenCLMem.cpp:54:8: error: use of undeclared identifier 'com_aparapi_internal_opencl_OpenCLArgDescriptor_ARG_VECTOR2_BIT'
if (argisset(argBits, VECTOR2) {
^
src/cpp/invoke/JavaArgs.h:8:42: note: expanded from macro 'argisset'
#define argisset(bits, token) (((bits) & arg(token)) == arg(token))
^
src/cpp/invoke/JavaArgs.h:7:21: note: expanded from macro 'arg'
#define arg(token) (com_aparapi_internal_opencl_OpenCLArgDescriptor_ARG_##token##_BIT)
^
<scratch space>:50:1: note: expanded from here
com_aparapi_internal_opencl_OpenCLArgDescriptor_ARG_VECTOR2_BIT
^
src/cpp/invoke/OpenCLMem.cpp:54:8: error: use of undeclared identifier 'com_aparapi_internal_opencl_OpenCLArgDescriptor_ARG_VECTOR2_BIT'
src/cpp/invoke/JavaArgs.h:8:57: note: expanded from macro 'argisset'
#define argisset(bits, token) (((bits) & arg(token)) == arg(token))
^
src/cpp/invoke/JavaArgs.h:7:21: note: expanded from macro 'arg'
#define arg(token) (com_aparapi_internal_opencl_OpenCLArgDescriptor_ARG_##token##_BIT)
^
<scratch space>:50:1: note: expanded from here
com_aparapi_internal_opencl_OpenCLArgDescriptor_ARG_VECTOR2_BIT
^
2 errors generated.
make: *** [src/cpp/invoke/libaparapi_la-OpenCLMem.lo] Error 1
It is really late and I'm too tired to investigate this right now (I can help more tomorrow) but it would appear you simple forgot to add your support for Vectors in this class: https://github.com/Syncleus/aparapi/blob/master/src/main/java/com/aparapi/internal/opencl/OpenCLArgDescriptor.java
@freemo I was able to solve buffer size on java side. There is already way to build buffer from "complex" object and restore it after OpenCL execution. That is good news because of no needs to change aparapi-native.
Vector feature on final step now!
@shabanovd Awesome, are all the tests passing now? Is the pr ready to accept/review?
@freemo not yet. It's just prove of concept. Now I need cover all vector operations, write tests and etc. It'll take this and next weeks.
@shabanovd sounds good. Let me know where I can help.
@shabanovd Any progress on this? I'm working on a new release soon and curious if i can help get this PR in on time or not.
@freemo do you have any deadline for release? ... I'll need to get back into it before I can recall what TODOs till it done.
@shabanovd No no specific deadline. Just want to make sure it stays active and synced with master.