https://bugs.freedesktop.org/show_bug.cgi?id=106572
Bug ID: 106572
Summary: Simply linking against libOpenCL.so tries accessing
the GPU
Product: Mesa
Version: git
Hardware: Other
OS: All
Status: NEW
Severity: normal
Priority: medium
Component: Mesa core
Assignee: mesa-dev@lists.freedesktop.org
Reporter: bugs.freedesk...@haasn.xyz
QA Contact: mesa-dev@lists.freedesktop.org
$ echo 'int main() {}' > test.c && gcc -o test test.c -lOpenCL && strace -e
open ./test
open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
open("/sys/dev/char/226:128/device/drm",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 4
open("/sys/dev/char/226:128/device/drm",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
open("/dev/dri", O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
open("/etc/nsswitch.conf", O_RDONLY|O_CLOEXEC) = 5
open("/etc/passwd", O_RDONLY|O_CLOEXEC) = 5
open("/sys/devices/system/cpu/online", O_RDONLY|O_CLOEXEC) = 5
open("/sys/dev/char/226:128/device/drm",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
open("/sys/dev/char/226:128/device/drm",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
open("/sys/dev/char/226:128/device/drm",
O_RDONLY|O_NONBLOCK|O_CLOEXEC|O_DIRECTORY) = 5
+++ exited with 0 +++
This behavior surprises me because e.g. libGL.so does not have the same sort of
behavior, and neither do libvulkan.so or other third party implementations of
OpenGL/OpenCL.
Merely *linking* to a library should not cause any runtime GPU access. Normally
I'd expect this kind of loading logic to happen when the CL device itself is
initialized, similar to how OpenGL's GPU-specific drivers only get initialized
when calling `glXCreateContext` and ditto for vkCreateInstance /
vkCreateDevice.
Context: https://bugs.gentoo.org/show_bug.cgi?id=656086
Since this behavior surprises me, I'm also filing a bug here, even though the
issue is technically downstream. Maybe we could get some elaboration.
--
You are receiving this mail because:
You are the assignee for the bug.
You are the QA Contact for the bug.___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev