Gentoo Archives: gentoo-dev

From: Marek Szuba <marecki@g.o>
To: gentoo-dev@l.g.o
Cc: patrick@g.o
Subject: [gentoo-dev] RFC: Rethinking virtual/opencl and eselect-opencl
Date: Thu, 02 Apr 2020 14:32:06
Message-Id: a6b83c94-3d24-e77e-53eb-bf7d429b8cf5@gentoo.org
1 (with many thanks to everyone who mulled on this problem in #gentoo-dev
2 yesterday, mattst88 in particular)
3
4 So, yesterday's attempt to begin phasing support for 32-bit OpenCL out
5 of Gentoo (which, to remind everyone who may not have followed the
6 earlier discussion, would essentially acknowledge the status quo of most
7 OpenCL providers only supporting native amd64 ABI) has failed miserably:
8 the masking of abi_x86_32 in virtual/opencl on amd64 and of
9 virtual/opencl as a whole on x86 resulted in breakages in the dependency
10 graph.
11
12 On the one hand, there are several packages keyworded x86 which
13 unconditionally depend on virtual/opencl:
14 - dev-libs/clhpp
15 - dev-python/pyopencl
16 - net-wireless/cpyrit-opencl
17 - sci-libs/clblas
18 - sci-libs/clblast
19 This is the easier part of the problem - seeing as most OpenCL providers
20 we now have in the tree (the exceptions being proprietary AMD and NVidia
21 drivers for legacy GPUs) do not support x86 anyway, it should be safe to
22 simply drop the keyword.
23
24 On the other, there is the much hairier issue of multilib-capable packages:
25 - dev-libs/cl
26 - app-emulation/crossover-bin
27 - app-emulation/wine-staging
28 - app-emulation/wine-vanilla
29 - app-text/tesseract
30 - media-libs/opencv
31 - media-libs/x264
32 - media-video/ffmpeg
33 for which the consensus of yesterday's discussion seems to be that
34 assuming the dropping of multilib or opencl support altogether is not an
35 option, we would have to have separate src_configure (at the very least)
36 stages for different ABIs.
37
38
39 It seems therefore that the easiest way of phasing out 32-bit OpenCL
40 would be for virtual/opencl to list a dummy provider that is both
41 keyworded x86 and multilib-capable, and provides both header files and
42 libraries reverse dependencies need to build successfully regardless of
43 what OpenCL devices, if any, are actually available. Fortunately there
44 already are packages in the tree which do just that - OpenCL ICD
45 loaders, i.e. dev-libs/ocl-icd (has stable keywords for both amd64 and
46 x86) and, since yesterday evening, dev-libs/opencl-icd-loader (the
47 official Khronos Group ICD loader, the first tagged version of which got
48 released in mid-March).
49
50 Then, between mattst88 and myself we have come to the conclusion that it
51 might in fact make sense to have virtual/opencl provide *only* an ICD
52 loader and merely inform the users what hardware-specific runtimes are
53 available. Advantages of this approach:
54 - both ocl-icd and opencl-icd-loader are keyworded x86 (actually, I
55 realised this morning that I have made a mistake with the latter because
56 it is no longer up to developers to keyword things for x86 themselves -
57 but I *have* tested this in a 32-bit chroot) and multilib-capable so
58 they will keep the dependency tree consistent even if there are no
59 actual OpenCL runtimes capable of supporting abi_x86_32;
60 - intel-neo, rocm-opencl-runtime, amdgpu-pro-opencl and mesa[opencl]
61 all actually *require* an IDC loader to work, intel-ocl-sdk (or at least
62 version 4 of it) works fine through a loader, and given
63 nvidia-drivers[uvm] ebuilds install an ICD file, I presume they are fine
64 with the loader as well;
65 - not having to switch between OpenCL runtimes would allow us to phase
66 out eselect-opencl (similarly to how the introduction of an OpenGL
67 loader has allowed us to get rid of eselect-opengl), or at the very
68 least limit it to the management of OpenCL header files;
69 - it would make it easier for users to enable out-of-tree runtimes,
70 e.g. manually installed whole AMDGPU-Pro stack or Beignet from an overlay;
71 - the current VIDEO_CARDS-based way of selecting runtimes is quite
72 often misleading, namely:
73 * intel-neo only supports Intel GPUs from Broadwell onwards rather
74 than everything served by the i965 driver;
75 * amdgpu-pro-opencl is not compatible Vega 10 and newer GPUs, and to
76 make it worse it causes segfaults rather than simply ignore such GPUs;
77 * nvidia-drivers[uvm] is actually several sets of drivers, with
78 different versions appropriate for different GPUs;
79 * mesa[opencl] only supports some (old) Nvidia GPUs;
80 * intel-ocl-sdk does not support non-Intel amd64 CPUs.
81 Having the options presented to users in human-readable fashion will
82 IMHO work better.
83
84
85 Therefore, mattst88 and I (or to clarify: the write-up is mine but Matt
86 has contributed several important points to it) would like to propose
87 the following steps to take:
88
89 1. Introduce a new version of virtual/opencl with RDEPEND consisting
90 *only* of app-eselect/eselect-opencl and
91 dev-libs/ocl-icd[khronos-headers], with the list of actual runtimes
92 moved to a postinst message and expanded to explain what works where;
93
94 2. Have all ebuilds of OpenCL runtimes depend on virtual/opencl
95 (replacing the dependency on dev-libs/ocl-icd wherever it is present)
96 but do NOT call "eselect opencl" if they currently do;
97
98 3. Test if downstream applications are happy with the new unified OpenCL
99 headers required by the Khronos Group ICD loader and if they are, add
100 dev-libs/opencl-icd-loader to virtual/opencl as an alternative to ocl-icd;
101
102 4. Think what, if anything, we still want eselect-opencl to do, and in
103 the event of having decided to remove it or reduce its functionality
104 adjust some or all install paths in ICD-loader ebuilds to point directly
105 to /usr rather then subdirectories of /usr/$(get_libdir)/OpenCL/vendors.
106
107
108 Opinions? Comments? Flames?
109
110 --
111 Marecki

Attachments

File name MIME type
signature.asc application/pgp-signature

Replies