Mesa (main): llvmpipe: align scratch size to 64-bit size.

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue May 17 11:24:47 UTC 2022


Module: Mesa
Branch: main
Commit: 0a056f84ed47736570bf1cc432e7df756b057011
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=0a056f84ed47736570bf1cc432e7df756b057011

Author: Dave Airlie <airlied at redhat.com>
Date:   Tue May  3 10:33:02 2022 +1000

llvmpipe: align scratch size to 64-bit size.

This fixes a crash with luxmark where it uses a 12-byte scratch space,
but when llvmpipe allocates it for 8 lanes, it isn't properly aligned
for 64-bit.

Karol found this debugging rusticl.

Reviewed-by: Emma Anholt <emma at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16288>

---

 src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
index 44358b6552e..f8079701d7a 100644
--- a/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
+++ b/src/gallium/auxiliary/gallivm/lp_bld_nir_soa.c
@@ -2750,13 +2750,14 @@ void lp_build_nir_soa(struct gallivm_state *gallivm,
 
    bld.bld_base.shader = shader;
 
+   bld.scratch_size = ALIGN(shader->scratch_size, 8);
    if (shader->scratch_size) {
       bld.scratch_ptr = lp_build_array_alloca(gallivm,
                                               LLVMInt8TypeInContext(gallivm->context),
-                                              lp_build_const_int32(gallivm, shader->scratch_size * type.length),
+                                              lp_build_const_int32(gallivm, bld.scratch_size * type.length),
                                               "scratch");
    }
-   bld.scratch_size = shader->scratch_size;
+
    emit_prologue(&bld);
    lp_build_nir_llvm(&bld.bld_base, shader);
 



More information about the mesa-commit mailing list