-
Notifications
You must be signed in to change notification settings - Fork 453
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Android] OpenCL detection / namespace isolation #5931
Comments
Hello @brevilo, Thank you for the report.
Probably, your vendor doesn't support exported namespaces at all?
This is basically why we need exported namespace, because it gives us the correct 'virtual' path to the library that we can load.
I'm not sure about |
Is this a (device) vendor or OS question? I thought the namespace isolation stuff came with project treble (Android 8) and should thus be a given on any newer Android release? Are "exported" namespaces something special and/or optional? FYI, for my Adreno it's indeed (only) |
FYI, I recognize your approach to deal with the namespace / private API crap as being this one (see step 3 there). Are you aware of the changes in Android 11 shown there? Not sure how stable this offset-approach is but it might be worth a try. |
I don't have a definite answer to this this question.
Yes, I have seen them when I was working on this fix. For me this was not an issue on the devices I have tested (again, this might be vendor specific, and I was just lucky to not catch this issue with the removed function from the export table).
I'm pretty much sure this is not stable at all. For example in my case (as described above) there was no such an issue, so this is really vendor specific. I need to think on possible solutions. |
This is the vendors' fault anyway since there is a solution, that's even part of the OpenCL CTS for Android. They just would have to adopt it but apparently can't be bothered 👎 |
I tested the code on my Samsung S24 Ultra 1/ dlopen libOpenCL.so fails without export LD_LIBRARY_PATH="/system/vendor/lib64"
2/ android_get_exported_namespace isn't available, but __loader_android_get_exported_namespace works
btw, the native client detects the (Ardeno) GPU correctly, so the behavior in the app may differ (I'm testing it on Termux)
|
@ahorek, wanna make a proper PR? |
termux has an incorrect link to libOpenCL.so: /data/data/com.termux/files/usr/share/man/man7/libOpenCL.so.7.gz that's why the Android fallback doesn't work. However, it's specific to the terminal, so it doesn't have to be fixed. It won't happen in the real app. attempt to load the library directly fails as expected but dlopen with namespaces works on both of my devices (Samsung S14 Ultra (Ardeno), Samsung S6 Edge (Mali)) @brevilo could you test the code on your device and check if you can load the library somehow? does
work? |
Can do next week. Won't that run into the same isolation problem when run in the terminal? |
Direct dlopen("libOpenCL.so") part is commented to prevent loading the wrong termux library, but it should behave the same. The code is extracted from boinc sources for easier experiments without external dependencies, you can simply compile it with:
and you should get this output
|
I'm not sure this is a portable solution |
Ah, sorry. I understood that you asked about |
Not strictly. But it's the common path on virtually all modern devices. A discovery code could try the known paths and pick the one that returns the lib in search. |
Yes, I just wanted to check if |
Describe the bug
I'm trying to introduce OpenCL support for our Android apps. However, on my test device BOINC doesn't detect OpenCL properly, already failing at the namespace preparation:
To me this means that
__loader_android_get_exported_namespace
returnsNULL
. Any idea why?While at it (unrelated to the above):
/system/vendor/lib[64]
instead.libOpenCL.so
only apply to Adreno GPUs? AFAIK, Mali useslibGLES_mali.so
and PowerVRlibPVROCL.so
for their OpenCL runtimes, no?Steps To Reproduce
coproc_info.xml
orstderrgpudetect.txt
)System Information
aarch64
ARMv8a
The text was updated successfully, but these errors were encountered: