diff options
author | Ben Crocker <[email protected]> | 2019-11-13 20:27:24 +0000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2019-11-14 23:07:26 +0000 |
commit | 9c3be6d21fa6a45852045d0286b80fb420f82fe3 (patch) | |
tree | 247d1385425c3c1042c50d2776d24ca73722b473 /src/gallium/auxiliary | |
parent | 4242c572275138ec832c6a450cbf8891268e15b8 (diff) |
llvmpipe: use ppc64le/ppc64 Large code model for JIT-compiled shaders
Large programs, e.g. gnome-shell and firefox, may tax the
addressability of the Medium code model once a (potentially unbounded)
number of dynamically generated JIT-compiled shader programs are
linked in and relocated. Yet the default code model as of LLVM 8 is
Medium or even Small.
The cost of changing from Medium to Large is negligible:
- an additional 8-byte pointer stored immediately before the shader entrypoint;
- change an add-immediate (addis) instruction to a load (ld).
Testing with WebGL Conformance
(https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html)
yields clean runs with this change (and crashes without it).
Testing with glxgears shows no detectable performance difference.
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1753327, 1753789, 1543572, 1747110, and 1582226
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/223
Co-authored by: Nemanja Ivanovic <[email protected]>, Tom Stellard <[email protected]>
CC: [email protected]
Signed-off-by: Ben Crocker <[email protected]>
Diffstat (limited to 'src/gallium/auxiliary')
-rw-r--r-- | src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp index e80676d5062..40cc96824f3 100644 --- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp +++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp @@ -456,7 +456,20 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, * when not using MCJIT so no instructions are generated which the old JIT * can't handle. Not entirely sure if we really need to do anything yet. */ -#if UTIL_ARCH_LITTLE_ENDIAN && defined(PIPE_ARCH_PPC_64) + +#ifdef PIPE_ARCH_PPC_64 + /* + * Large programs, e.g. gnome-shell and firefox, may tax the addressability + * of the Medium code model once dynamically generated JIT-compiled shader + * programs are linked in and relocated. Yet the default code model as of + * LLVM 8 is Medium or even Small. + * The cost of changing from Medium to Large is negligible: + * - an additional 8-byte pointer stored immediately before the shader entrypoint; + * - change an add-immediate (addis) instruction to a load (ld). + */ + builder.setCodeModel(CodeModel::Large); + +#if UTIL_ARCH_LITTLE_ENDIAN /* * Versions of LLVM prior to 4.0 lacked a table entry for "POWER8NVL", * resulting in (big-endian) "generic" being returned on @@ -469,6 +482,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT, if (MCPU == "generic") MCPU = "pwr8"; #endif +#endif builder.setMCPU(MCPU); if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) { debug_printf("llc -mcpu option: %s\n", MCPU.str().c_str()); |