meson: Force use of LLVM ORCJIT for hosts without MCJIT support

Although the ORCJIT codepath is fresh and relatively less tested, this
is still better than no llvmpipe at all for those newer architectures
that will not gain MCJIT support, such as LoongArch or RISC-V.

Fixes: 6f02ec5ed1 ("llvmpipe: add an implementation with llvm orcjit")
Reviewed-by: Icenowy Zheng <uwu@icenowy.me>
Reviewed-by: Yukari Chiba <i@0x7f.cc>
Reviewed-by: David Heidelberg <david@ixit.cz>
Signed-off-by: WANG Xuerui <git@xen0n.name>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30599>
(cherry picked from commit 56f38672a2)
This commit is contained in:
WANG Xuerui 2024-08-10 18:15:23 +08:00 committed by Eric Engestrom
parent f11e04e331
commit 14f6b72604
3 changed files with 11 additions and 3 deletions

View file

@ -14,7 +14,7 @@
"description": "meson: Force use of LLVM ORCJIT for hosts without MCJIT support", "description": "meson: Force use of LLVM ORCJIT for hosts without MCJIT support",
"nominated": true, "nominated": true,
"nomination_type": 1, "nomination_type": 1,
"resolution": 0, "resolution": 1,
"main_sha": null, "main_sha": null,
"because_sha": "6f02ec5ed18a0a9bdd3739287cce54a621ea3bad", "because_sha": "6f02ec5ed18a0a9bdd3739287cce54a621ea3bad",
"notes": null "notes": null

View file

@ -1754,7 +1754,6 @@ if with_clc
llvm_optional_modules += ['all-targets', 'windowsdriver', 'frontendhlsl', 'frontenddriver'] llvm_optional_modules += ['all-targets', 'windowsdriver', 'frontendhlsl', 'frontenddriver']
endif endif
draw_with_llvm = get_option('draw-use-llvm') draw_with_llvm = get_option('draw-use-llvm')
llvm_with_orcjit = get_option('llvm-orcjit')
if draw_with_llvm if draw_with_llvm
llvm_modules += 'native' llvm_modules += 'native'
# lto is needded with LLVM>=15, but we don't know what LLVM verrsion we are using yet # lto is needded with LLVM>=15, but we don't know what LLVM verrsion we are using yet
@ -1762,6 +1761,12 @@ if draw_with_llvm
endif endif
amd_with_llvm = get_option('amd-use-llvm') amd_with_llvm = get_option('amd-use-llvm')
# MCJIT is deprecated in LLVM and will not accept new architecture ports,
# so any architecture not in the exhaustive list will have to rely on LLVM
# ORCJIT for llvmpipe functionality.
llvm_has_mcjit = host_machine.cpu_family() in ['aarch64', 'arm', 'ppc', 'ppc64', 's390x', 'x86', 'x86_64']
llvm_with_orcjit = get_option('llvm-orcjit') or not llvm_has_mcjit
if with_amd_vk or with_gallium_radeonsi or with_clc or llvm_with_orcjit if with_amd_vk or with_gallium_radeonsi or with_clc or llvm_with_orcjit
_llvm_version = '>= 15.0.0' _llvm_version = '>= 15.0.0'
elif with_gallium_clover elif with_gallium_clover

View file

@ -444,7 +444,10 @@ option (
'llvm-orcjit', 'llvm-orcjit',
type : 'boolean', type : 'boolean',
value : false, value : false,
description: 'Build llvmpipe with LLVM ORCJIT support.' description: 'Build llvmpipe with LLVM ORCJIT support. Has no effect when ' +
'building for architectures without LLVM MCJIT support -- ' +
'ORCJIT is the only choice on such architectures and will ' +
'always be enabled.'
) )
option( option(