From: Quentin Schulz <[email protected]> We generate a wrapper for bindgen arguments when building with clang but we don't actually use clang variants of variables when generating the wrapper.
The default toolchain may not be clang, therefore TCOVERRIDE will be set to that toolchain instead and if variables have variants per toolchain, the one for the default toolchain will be used instead of the one for clang. This is an issue that can be highlighted by trying to build rusticl OpenCL mesa driver while the default toolchain is GCC and for an ARM big.LITTLE architecture (e.g. cortex-a76.cortex-a55). Most mesa drivers can be built with either GCC or clang but rusticl OpenCL driver must be built with clang for now. clang toolchain doesn't actually support the big.LITTLE architecture at all and must build for the LITTLE part of it (cortex-a55). This is currently handled by the CPU_TUNE_ARG variable in the impacted CPU include configuration files. Until now, the GCC variant would be used and the flags would contain -mcpu=cortexa-76.cortex-a55, failing the build. After this patch, clang-specific variables can be used and this will result in the bindgen flags having e.g. -mcpu=cortex-a55 instead. This fixes mesa's rusticl build on Rockchip RK3399 and RK3588 big.LITTLE SoCs. Signed-off-by: Quentin Schulz <[email protected]> --- This was tested on top of a local branch with mesa-26.0.0 recipe. Only tested with mesa (and any of its dependencies using meson I guess). I can now have clpeak running on my RK3588 boards and mostly working on my RK3399 (the GPU scheduler times out for float16 Global memory bandwidth (GBPS) benchmark but all the other tests seem to be working fine). Note you must set RUSTICL_ENABLE environment variable to panfrost otherwise it won't work. --- meta/classes-recipe/meson.bbclass | 23 +++++++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/meta/classes-recipe/meson.bbclass b/meta/classes-recipe/meson.bbclass index 2c098771fe..ce607703e3 100644 --- a/meta/classes-recipe/meson.bbclass +++ b/meta/classes-recipe/meson.bbclass @@ -58,11 +58,30 @@ def rust_tool(d, target_var): return "rust = %s" % repr(cmd) def bindgen_args(d): + # Variables may have clang-specific values and this function is only called + # for bindgen_clang_args, meaning the args must be the ones used by clang. + # The default toolchain may not be clang and some recipes may use two + # toolchains (e.g. mesa rusticl/gallium-llvm requires clang but not the + # other drivers in the recipe). + # This is necessary for example for ARM big.LITTLE CPU architecture where + # -mcpu will be set to e.g. cortex-a76.cortex-a55 for GCC but clang doesn't + # support big.LITTLE so we need to have cortex-a55 only, see CPU_TUNE_ARG + # variable. + # Therefore, to know which parameters bindgen must use with clang, we + # simulate using clang by setting the TCOVERRIDE to toolchain-clang + # temporarily. + # This is of course unnecessary if the default toolchain is already clang. + if d.getVar('TCOVERRIDE') != 'toolchain-clang': + localdata = bb.data.createCopy(d) + localdata.setVar('TCOVERRIDE', 'toolchain-clang') + else: + localdata = d + args = '${HOST_CC_ARCH}${TOOLCHAIN_OPTIONS} --target=${TARGET_SYS}' # For SDK packages TOOLCHAIN_OPTIONS don't contain full sysroot path - if bb.data.inherits_class("nativesdk", d): + if bb.data.inherits_class("nativesdk", localdata): args += ' --sysroot=${STAGING_DIR_HOST}${SDKPATHNATIVE}${prefix_nativesdk}' - items = d.expand(args).split() + items = localdata.expand(args).split() return repr(items[0] if len(items) == 1 else items) addtask write_config before do_configure --- base-commit: 3a8f0075d52cb653118774baa03aa8d5231f943c change-id: 20260212-mesa-opencl-big-little-89c77def7294 Best regards, -- Quentin Schulz <[email protected]>
-=-=-=-=-=-=-=-=-=-=-=- Links: You receive all messages sent to this group. View/Reply Online (#231053): https://lists.openembedded.org/g/openembedded-core/message/231053 Mute This Topic: https://lists.openembedded.org/mt/117778745/21656 Group Owner: [email protected] Unsubscribe: https://lists.openembedded.org/g/openembedded-core/unsub [[email protected]] -=-=-=-=-=-=-=-=-=-=-=-
