JOCL icon indicating copy to clipboard operation
JOCL copied to clipboard

Google pixel support

Open MankaranSingh opened this issue 2 years ago • 3 comments

Thanks for the amazing library. work flawlessly on desktop and android phones. But this is not able to work on google pixel phones, these pixels have libOpenCL-pixel.so that needs to be loaded.

tnn also had some problems with pixel and this could be a reference issue for how to fix this issue https://github.com/Tencent/TNN/issues/398

MankaranSingh avatar Apr 20 '23 09:04 MankaranSingh

I'm lacking some context here, and don't even know what the target architecture of the Google pixel is. Is it correct that there has to be a native library that is linked against libOpenCL-pixel.so? (I don't know who could build this, but ... if someone provided it, I could add it to one of the next releases)

gpu avatar Apr 20 '23 18:04 gpu

`libOpenCL-pixel.so is Google pixel's openCL lib name (like libPVROCL) for powerVR. Its android with mostly arm64-v8 arch. I can open a pull request once this works.

MankaranSingh avatar Apr 21 '23 11:04 MankaranSingh

Its android with mostly arm64-v8 arch

That word "mostly" is one point raises the question for me here. The native library that is supposed to be loaded has to match the architecture. And this information has to be encoded in the name of the library. So there is a function in the LibUtils class that assembles that file name. This function may return something like

libJOCL_2_0_4-linux-x86_64.so

or

JOCL_2_0_4-windows-x86.dll

I assume that there is no difference between "arm64-v8" and "arm64" (without the "-v8"), so the name of the library on Android would be libJOCL_2_0_4-android-arm64.so.


Another question that is relevant here: Is there a difference between "Android on Google Pixel" and "Android elsewhere"?

The point is:

If we add a single libJOCL_2_0_4-android-arm64.so to JOCL, will this be linked

  • against libOpenCL-pixel.so or
  • against libOpenCL.so

?

If it has to be linked against different libOpenCL... files (depending on whether it's on Pixel or not), then we'd have to handle this, by creating two file names:

  • libJOCL_2_0_4-android-arm64.so (linked against libOpenCL.so)
  • libJOCL_2_0_4-android-pixel-arm64.so (linked against libOpenCL-pixel.so)

That sounds like a bit of pain in the back, but ... well, whatever Google is doing there, it could be manageable. The question is: Can we unambiguously identify the "Pixel" case in https://github.com/gpu/JOCL/blob/fefa66d49dfefddde0f7f99ced4e3329e376cba8/src/main/java/org/jocl/LibUtils.java#L546 ?

gpu avatar Apr 24 '23 14:04 gpu