xref: /aosp_15_r20/external/mesa3d/docs/rusticl.rst (revision 6104692788411f58d303aa86923a9ff6ecaded22)
1*61046927SAndroid Build Coastguard WorkerRusticl
2*61046927SAndroid Build Coastguard Worker=======
3*61046927SAndroid Build Coastguard Worker
4*61046927SAndroid Build Coastguard WorkerRusticl is an OpenCL implementation on top of Gallium drivers.
5*61046927SAndroid Build Coastguard Worker
6*61046927SAndroid Build Coastguard WorkerEnabling
7*61046927SAndroid Build Coastguard Worker--------
8*61046927SAndroid Build Coastguard Worker
9*61046927SAndroid Build Coastguard WorkerIn order to use Rusticl on any platform the environment variable
10*61046927SAndroid Build Coastguard Worker:envvar:`RUSTICL_ENABLE` has to be used. Rusticl does not advertise devices
11*61046927SAndroid Build Coastguard Workerfor any driver by default yet as doing so can impact system stability until
12*61046927SAndroid Build Coastguard Workerremaining core issues are ironed out.
13*61046927SAndroid Build Coastguard Worker
14*61046927SAndroid Build Coastguard WorkerBuilding
15*61046927SAndroid Build Coastguard Worker--------
16*61046927SAndroid Build Coastguard Worker
17*61046927SAndroid Build Coastguard WorkerTo build Rusticl you need to satisfy the following build dependencies:
18*61046927SAndroid Build Coastguard Worker
19*61046927SAndroid Build Coastguard Worker-  ``rustc``
20*61046927SAndroid Build Coastguard Worker-  ``rustfmt`` (highly recommended, but only *required* for CI builds
21*61046927SAndroid Build Coastguard Worker   or when authoring patches)
22*61046927SAndroid Build Coastguard Worker-  ``bindgen``
23*61046927SAndroid Build Coastguard Worker-  `LLVM <https://github.com/llvm/llvm-project/>`__ built with
24*61046927SAndroid Build Coastguard Worker   ``libclc`` and ``-DLLVM_ENABLE_DUMP=ON``.
25*61046927SAndroid Build Coastguard Worker-  `SPIRV-Tools <https://github.com/KhronosGroup/SPIRV-Tools>`__
26*61046927SAndroid Build Coastguard Worker-  `SPIRV-LLVM-Translator
27*61046927SAndroid Build Coastguard Worker   <https://github.com/KhronosGroup/SPIRV-LLVM-Translator>`__ for a
28*61046927SAndroid Build Coastguard Worker   ``libLLVMSPIRVLib.so`` matching your version of LLVM, i.e. if you're
29*61046927SAndroid Build Coastguard Worker   using LLVM 15 (``libLLVM.so.15``), then you need a
30*61046927SAndroid Build Coastguard Worker   ``libLLVMSPIRVLib.so.15``.
31*61046927SAndroid Build Coastguard Worker
32*61046927SAndroid Build Coastguard WorkerThe minimum versions to build Rusticl are:
33*61046927SAndroid Build Coastguard Worker
34*61046927SAndroid Build Coastguard Worker-  Rust: 1.76
35*61046927SAndroid Build Coastguard Worker-  Meson: 1.4.0
36*61046927SAndroid Build Coastguard Worker-  Bindgen: 0.65.0
37*61046927SAndroid Build Coastguard Worker-  LLVM: 15.0.0
38*61046927SAndroid Build Coastguard Worker-  Clang: 15.0.0
39*61046927SAndroid Build Coastguard Worker   Updating clang requires a rebuilt of mesa and rusticl if and only if the value of
40*61046927SAndroid Build Coastguard Worker   ``CLANG_RESOURCE_DIR`` changes. It is defined through ``clang/Config/config.h``.
41*61046927SAndroid Build Coastguard Worker-  SPIRV-Tools: any version (recommended: v2022.3)
42*61046927SAndroid Build Coastguard Worker
43*61046927SAndroid Build Coastguard WorkerAfterwards you only need to add ``-Dgallium-rusticl=true -Dllvm=enabled
44*61046927SAndroid Build Coastguard Worker-Drust_std=2021`` to your build options.
45*61046927SAndroid Build Coastguard Worker
46*61046927SAndroid Build Coastguard WorkerMost of the code related to Mesa's C code lives inside ``/mesa``, with
47*61046927SAndroid Build Coastguard Workerthe occasional use of enums, structs or constants through the code base.
48*61046927SAndroid Build Coastguard Worker
49*61046927SAndroid Build Coastguard WorkerIf you need help ping ``karolherbst`` either in ``#dri-devel`` or
50*61046927SAndroid Build Coastguard Worker``#rusticl`` on OFTC.
51*61046927SAndroid Build Coastguard Worker
52*61046927SAndroid Build Coastguard WorkerContributing
53*61046927SAndroid Build Coastguard Worker------------
54*61046927SAndroid Build Coastguard Worker
55*61046927SAndroid Build Coastguard WorkerThe minimum configuration you need to start developing with rust
56*61046927SAndroid Build Coastguard Workeris ``RUSTC=clippy-driver meson configure -Dgallium-rusticl=true
57*61046927SAndroid Build Coastguard Worker-Dllvm=enabled -Drust_std=2021``. In addition you probably want to enable
58*61046927SAndroid Build Coastguard Workerany device drivers on your platform. Some device drivers as well as some
59*61046927SAndroid Build Coastguard Workerfeatures are locked behind flags during runtime. See
60*61046927SAndroid Build Coastguard Worker:ref:`Rusticl environment variables <rusticl-env-var>` for
61*61046927SAndroid Build Coastguard Workermore info.
62*61046927SAndroid Build Coastguard Worker
63*61046927SAndroid Build Coastguard WorkerAll patches that are potentially conformance breaking and also patches
64*61046927SAndroid Build Coastguard Workerthat add new features should be ran against the appropriate conformance
65*61046927SAndroid Build Coastguard Workertests.
66*61046927SAndroid Build Coastguard Worker
67*61046927SAndroid Build Coastguard WorkerAlso, make sure the formatting is in order before submitting code. That
68*61046927SAndroid Build Coastguard Workercan easily be done via ``git ls-files */{lib,main}.rs | xargs rustfmt``.
69*61046927SAndroid Build Coastguard Worker
70*61046927SAndroid Build Coastguard WorkerWhen submitting Merge Requests or filing bugs related to Rusticl, make
71*61046927SAndroid Build Coastguard Workersure to add the ``Rusticl`` label so people subscribed to that Label get
72*61046927SAndroid Build Coastguard Workerpinged.
73*61046927SAndroid Build Coastguard Worker
74*61046927SAndroid Build Coastguard WorkerKnown issues
75*61046927SAndroid Build Coastguard Worker------------
76*61046927SAndroid Build Coastguard Worker
77*61046927SAndroid Build Coastguard WorkerOne issue you might come across is, that the Rust edition meson sets is
78*61046927SAndroid Build Coastguard Workernot right. This is a known `meson bug
79*61046927SAndroid Build Coastguard Worker<https://github.com/mesonbuild/meson/issues/10664>`__ and in order to
80*61046927SAndroid Build Coastguard Workerfix it, simply run ``meson configure $your_build_dir -Drust_std=2021``
81