|
|
653880 |
From d0ff02e567541468309923fed2320da6cbd81779 Mon Sep 17 00:00:00 2001
|
|
|
653880 |
From: Ben Crocker <bcrocker@redhat.com>
|
|
|
653880 |
Date: Thu, 21 Nov 2019 17:33:31 -0500
|
|
|
653880 |
Subject: [PATCH] llvmpipe: use ppc64le/ppc64 Large code model for JIT-compiled
|
|
|
653880 |
shaders
|
|
|
653880 |
|
|
|
653880 |
Large programs, e.g. gnome-shell and firefox, may tax the
|
|
|
653880 |
addressability of the Medium code model once a (potentially unbounded)
|
|
|
653880 |
number of dynamically generated JIT-compiled shader programs are
|
|
|
653880 |
linked in and relocated. Yet the default code model as of LLVM 8 is
|
|
|
653880 |
Medium or even Small.
|
|
|
653880 |
|
|
|
653880 |
The cost of changing from Medium to Large is negligible:
|
|
|
653880 |
- an additional 8-byte pointer stored immediately before the shader entrypoint;
|
|
|
653880 |
- change an add-immediate (addis) instruction to a load (ld).
|
|
|
653880 |
|
|
|
653880 |
Testing with WebGL Conformance
|
|
|
653880 |
(https://www.khronos.org/registry/webgl/sdk/tests/webgl-conformance-tests.html)
|
|
|
653880 |
yields clean runs with this change (and crashes without it).
|
|
|
653880 |
|
|
|
653880 |
Testing with glxgears shows no detectable performance difference.
|
|
|
653880 |
|
|
|
653880 |
Bugzilla: https://bugzilla.redhat.com/show_bug.cgi?id=1753327, 1543572, 1747110, and 1582226
|
|
|
653880 |
|
|
|
653880 |
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/223
|
|
|
653880 |
|
|
|
653880 |
Co-authored by: Nemanja Ivanovic <nemanjai@ca.ibm.com>, Tom Stellard <tstellar@redhat.com>
|
|
|
653880 |
|
|
|
653880 |
CC: mesa-stable@lists.freedesktop.org
|
|
|
653880 |
|
|
|
653880 |
Signed-off-by: Ben Crocker <bcrocker@redhat.com>
|
|
|
653880 |
Reviewed-by: Adam Jackson <ajax@redhat.com>
|
|
|
653880 |
---
|
|
|
653880 |
src/gallium/auxiliary/gallivm/lp_bld_misc.cpp | 15 ++++++++++++++-
|
|
|
653880 |
1 file changed, 14 insertions(+), 1 deletion(-)
|
|
|
653880 |
|
|
|
653880 |
diff --git a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
|
|
|
653880 |
--- a/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
|
|
|
653880 |
+++ b/src/gallium/auxiliary/gallivm/lp_bld_misc.cpp
|
|
|
653880 |
@@ -686,7 +686,19 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|
|
653880 |
* when not using MCJIT so no instructions are generated which the old JIT
|
|
|
653880 |
* can't handle. Not entirely sure if we really need to do anything yet.
|
|
|
653880 |
*/
|
|
|
653880 |
-#if defined(PIPE_ARCH_LITTLE_ENDIAN) && defined(PIPE_ARCH_PPC_64)
|
|
|
653880 |
+#ifdef PIPE_ARCH_PPC_64
|
|
|
653880 |
+ /*
|
|
|
653880 |
+ * Large programs, e.g. gnome-shell and firefox, may tax the addressability
|
|
|
653880 |
+ * of the Medium code model once dynamically generated JIT-compiled shader
|
|
|
653880 |
+ * programs are linked in and relocated. Yet the default code model as of
|
|
|
653880 |
+ * LLVM 8 is Medium or even Small.
|
|
|
653880 |
+ * The cost of changing from Medium to Large is negligible:
|
|
|
653880 |
+ * - an additional 8-byte pointer stored immediately before the shader entrypoint;
|
|
|
653880 |
+ * - change an add-immediate (addis) instruction to a load (ld).
|
|
|
653880 |
+ */
|
|
|
653880 |
+ builder.setCodeModel(CodeModel::Large);
|
|
|
653880 |
+
|
|
|
653880 |
+#ifdef PIPE_ARCH_LITTLE_ENDIAN
|
|
|
653880 |
/*
|
|
|
653880 |
* Versions of LLVM prior to 4.0 lacked a table entry for "POWER8NVL",
|
|
|
653880 |
* resulting in (big-endian) "generic" being returned on
|
|
|
653880 |
@@ -698,6 +710,7 @@ lp_build_create_jit_compiler_for_module(LLVMExecutionEngineRef *OutJIT,
|
|
|
653880 |
*/
|
|
|
653880 |
if (MCPU == "generic")
|
|
|
653880 |
MCPU = "pwr8";
|
|
|
653880 |
+#endif
|
|
|
653880 |
#endif
|
|
|
653880 |
builder.setMCPU(MCPU);
|
|
|
653880 |
if (gallivm_debug & (GALLIVM_DEBUG_IR | GALLIVM_DEBUG_ASM | GALLIVM_DEBUG_DUMP_BC)) {
|
|
|
653880 |
--
|
|
|
653880 |
2.21.0
|
|
|
653880 |
|