From 69187be071f73f15e7d96875c741608409980914 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Sat, 31 Aug 2024 12:10:06 +0200 Subject: [PATCH 1/5] mesa: Use ThinLTO & Clang Signed-off-by: Peter Jung --- mesa/lib32-mesa/PKGBUILD | 16 +++ mesa/mesa/.SRCINFO | 4 +- mesa/mesa/30862.patch | 161 ++++++++++++++++++++++++++++++ mesa/mesa/PKGBUILD | 18 +++- mesa/mesa/fix-rusticl-build.patch | 43 ++++++++ 5 files changed, 239 insertions(+), 3 deletions(-) create mode 100644 mesa/mesa/30862.patch create mode 100644 mesa/mesa/fix-rusticl-build.patch diff --git a/mesa/lib32-mesa/PKGBUILD b/mesa/lib32-mesa/PKGBUILD index ff47bc18..ecc3e295 100644 --- a/mesa/lib32-mesa/PKGBUILD +++ b/mesa/lib32-mesa/PKGBUILD @@ -75,6 +75,8 @@ makedepends=( rust-bindgen wayland-protocols xorgproto + lld + llvm-libs ) options=( # GCC 14 LTO causes segfault in LLVM under si_llvm_optimize_module @@ -207,10 +209,24 @@ build() { export BINDGEN_EXTRA_CLANG_ARGS="-m32" + # Set Clang as compiler + export AR=llvm-ar + export CC=clang + export CXX=clang++ + export NM=llvm-nm + export RANLIB=llvm-ranlib + + export CFLAGS+=" -flto=thin" + export CXXFLAGS+=" -flto=thin" + export LDFLAGS+=" -Wl,--undefined-version -fuse-ld=lld" + # Build only minimal debug info to reduce size CFLAGS+=" -g1" CXXFLAGS+=" -g1" + # LTO needs more open files + ulimit -n 4096 + # Inject subproject packages export MESON_PACKAGE_CACHE_DIR="$srcdir" diff --git a/mesa/mesa/.SRCINFO b/mesa/mesa/.SRCINFO index f34acbfe..30d34a58 100644 --- a/mesa/mesa/.SRCINFO +++ b/mesa/mesa/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = mesa pkgdesc = Open-source OpenGL drivers pkgver = 24.2.2 - pkgrel = 2 + pkgrel = 5 epoch = 1 url = https://www.mesa3d.org/ arch = x86_64 @@ -35,6 +35,7 @@ pkgbase = mesa makedepends = xcb-util-keysyms makedepends = zlib makedepends = zstd + makedepends = lld makedepends = cbindgen makedepends = clang makedepends = cmake @@ -101,6 +102,7 @@ pkgbase = mesa sha256sums = 901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9 b2sums = 14b29989b056c3bc76cb64babef6e93dd31af37ea72674adaad3f7ef7373c004996e375941662b1c3bbacfd707a21e2e3631a116a841130edfa1bfe3450ae5ab b2sums = SKIP + b2sums = d6d69a2e2bfc83b0a84840dd043c8dd35c4c7af50e532bfd2fbe742dea9d4e2483f0978f06ddf0066a04ad63ddc3076a07193cac7083211eb04594382eb993e2 b2sums = da196d667e31f647c376c37b394caed7787f4a41d79526ac2177f328920f49d183ef10bdf16b369c00aee4eecc6bc8cd3038908065438d99e58ac97e62c5cbba b2sums = 53d57d8fcfa140e24bec9dbb377f852d4719c0404fc08c3b7a0cca6e0a9b2bfc607bb85126579b00d498283ae2b173fca63982128421151b238aa9051e8754f9 b2sums = a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823 diff --git a/mesa/mesa/30862.patch b/mesa/mesa/30862.patch new file mode 100644 index 00000000..f57b5fec --- /dev/null +++ b/mesa/mesa/30862.patch @@ -0,0 +1,161 @@ +From 85741c6a15de6ed402e0b5a8b2219dbdb83d5c44 Mon Sep 17 00:00:00 2001 +From: Timothy Arceri +Date: Tue, 27 Aug 2024 09:28:41 +1000 +Subject: [PATCH 1/2] nir/tests: make add_loop_terminators more flexible + +Here we update the helper to have an option to add the break to the else +blocks of the terminators. + +Reviewed-by: Konstantin Seurer +Part-of: +--- + src/compiler/nir/tests/opt_loop_tests.cpp | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp +index 0bbf1d043ba35..1fede9a5b49d4 100644 +--- a/src/compiler/nir/tests/opt_loop_tests.cpp ++++ b/src/compiler/nir/tests/opt_loop_tests.cpp +@@ -28,7 +28,7 @@ protected: + nir_opt_loop_test(); + + nir_deref_instr *add_loop_terminators(nir_if **term1, nir_if **term2, +- bool deref_array); ++ bool break_in_else, bool deref_array); + void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, + nir_def *def1, nir_def *def2); + +@@ -52,12 +52,16 @@ nir_opt_loop_test::nir_opt_loop_test() + + nir_deref_instr * + nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, +- bool deref_array) ++ bool break_in_else, bool deref_array) + { + /* Add first terminator */ + nir_def *one = nir_imm_int(b, 1); + nir_def *cmp_result = nir_ieq(b, in_def, one); + nir_if *nif = nir_push_if(b, cmp_result); ++ ++ if (break_in_else) ++ nir_push_else(b, nif); ++ + nir_jump(b, nir_jump_break); + nir_pop_if(b, nif); + +@@ -77,6 +81,10 @@ nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, + nir_def *two = nir_imm_int(b, 2); + nir_def *cmp_result2 = nir_ieq(b, ubo_def, two); + nir_if *nif2 = nir_push_if(b, cmp_result2); ++ ++ if (break_in_else) ++ nir_push_else(b, nif2); ++ + nir_jump(b, nir_jump_break); + nir_pop_if(b, nif2); + +@@ -107,7 +115,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) + */ + nir_loop *loop = nir_push_loop(b); + +- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false); ++ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, false); + + /* Load from deref that will be moved inside the continue branch of the + * first if-statements continue block. If not handled correctly during +@@ -131,7 +139,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_phi_index) + */ + nir_loop *loop = nir_push_loop(b); + +- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, true); ++ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, true); + + /* Load from deref that will be moved inside the continue branch of the + * first if-statements continue block. If not handled correctly during +@@ -160,7 +168,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis) + + nir_if *term1; + nir_if *term2; +- add_loop_terminators(&term1, &term2, false); ++ add_loop_terminators(&term1, &term2, false, false); + + nir_pop_loop(b, loop); + +@@ -188,7 +196,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis_nested_l + + nir_if *term1; + nir_if *term2; +- add_loop_terminators(&term1, &term2, false); ++ add_loop_terminators(&term1, &term2, false, false); + + nir_pop_loop(b, loop); + +-- +GitLab + + +From bb426b7f3c8bece76490737d21eeee4542979ad9 Mon Sep 17 00:00:00 2001 +From: Timothy Arceri +Date: Tue, 27 Aug 2024 11:08:23 +1000 +Subject: [PATCH 2/2] nir/tests: add basic terminator merge test + +Reviewed-by: Konstantin Seurer +Part-of: +--- + src/compiler/nir/tests/opt_loop_tests.cpp | 33 +++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp +index 1fede9a5b49d4..e797adee1763f 100644 +--- a/src/compiler/nir/tests/opt_loop_tests.cpp ++++ b/src/compiler/nir/tests/opt_loop_tests.cpp +@@ -31,6 +31,7 @@ protected: + bool break_in_else, bool deref_array); + void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, + nir_def *def1, nir_def *def2); ++ void test_merged_if(bool break_in_else); + + nir_def *in_def; + nir_variable *out_var; +@@ -108,6 +109,38 @@ nir_opt_loop_test::create_loop_phis(nir_loop *loop, + &phi_instr->instr); + } + ++void ++nir_opt_loop_test::test_merged_if(bool break_in_else) ++{ ++ /* Tests that opt_loop_merge_terminators results in valid nir and that ++ * the test condition is correct based on the location of the break in ++ * the terminators. ++ */ ++ nir_loop *loop = nir_push_loop(b); ++ ++ nir_if *term1; ++ nir_if *term2; ++ add_loop_terminators(&term1, &term2, break_in_else, false); ++ ++ nir_pop_loop(b, loop); ++ ++ ASSERT_TRUE(nir_opt_loop(b->shader)); ++ ++ nir_validate_shader(b->shader, NULL); ++ ++ nir_alu_instr *alu = nir_instr_as_alu(term2->condition.ssa->parent_instr); ++ if (break_in_else) ++ ASSERT_TRUE(alu->op == nir_op_iand); ++ else ++ ASSERT_TRUE(alu->op == nir_op_ior); ++} ++ ++TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_basic) ++{ ++ test_merged_if(false); ++ test_merged_if(true); ++} ++ + TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) + { + /* Tests that opt_loop_merge_terminators creates valid nir after it merges +-- +GitLab + diff --git a/mesa/mesa/PKGBUILD b/mesa/mesa/PKGBUILD index fcef6545..5ee554f6 100644 --- a/mesa/mesa/PKGBUILD +++ b/mesa/mesa/PKGBUILD @@ -24,7 +24,7 @@ pkgname=( mesa-docs ) pkgver=24.2.2 -pkgrel=3 +pkgrel=5 epoch=1 pkgdesc="Open-source OpenGL drivers" url="https://www.mesa3d.org/" @@ -60,7 +60,7 @@ makedepends=( xcb-util-keysyms zlib zstd - + lld # shared between mesa and lib32-mesa cbindgen clang @@ -139,6 +139,7 @@ done b2sums=('14b29989b056c3bc76cb64babef6e93dd31af37ea72674adaad3f7ef7373c004996e375941662b1c3bbacfd707a21e2e3631a116a841130edfa1bfe3450ae5ab' 'SKIP' + 'd6d69a2e2bfc83b0a84840dd043c8dd35c4c7af50e532bfd2fbe742dea9d4e2483f0978f06ddf0066a04ad63ddc3076a07193cac7083211eb04594382eb993e2' 'da196d667e31f647c376c37b394caed7787f4a41d79526ac2177f328920f49d183ef10bdf16b369c00aee4eecc6bc8cd3038908065438d99e58ac97e62c5cbba' '53d57d8fcfa140e24bec9dbb377f852d4719c0404fc08c3b7a0cca6e0a9b2bfc607bb85126579b00d498283ae2b173fca63982128421151b238aa9051e8754f9' 'a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823' @@ -218,10 +219,23 @@ build() { -D vulkan-layers=device-select,intel-nullhw,overlay ) + # Set Clang as compiler + export AR=llvm-ar + export CC=clang + export CXX=clang++ + export NM=llvm-nm + export RANLIB=llvm-ranlib + + export CFLAGS+=" -flto=thin" + export CXXFLAGS+=" -flto=thin" + export LDFLAGS+=" -Wl,--undefined-version -fuse-ld=lld" # Build only minimal debug info to reduce size CFLAGS+=" -g1" CXXFLAGS+=" -g1" + # LTO needs more open files + ulimit -n 4096 + # Inject subproject packages export MESON_PACKAGE_CACHE_DIR="$srcdir" diff --git a/mesa/mesa/fix-rusticl-build.patch b/mesa/mesa/fix-rusticl-build.patch new file mode 100644 index 00000000..fb01363b --- /dev/null +++ b/mesa/mesa/fix-rusticl-build.patch @@ -0,0 +1,43 @@ +From 93e96da9458c9d0348f2390dc0bea67cf140b1a0 Mon Sep 17 00:00:00 2001 +From: Karol Herbst +Date: Sun, 18 Aug 2024 00:08:50 +0200 +Subject: [PATCH] rusticl: do not use CL vector types in bindings and code + +Bindgen seems to miscompile them and I kinda thought I've done this +already in the past, but apparently not. + +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11722 +Part-of: +--- + src/gallium/frontends/rusticl/api/device.rs | 2 +- + src/gallium/frontends/rusticl/meson.build | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs +index 9793092db5ad4..c1cb7902e0371 100644 +--- a/src/gallium/frontends/rusticl/api/device.rs ++++ b/src/gallium/frontends/rusticl/api/device.rs +@@ -196,7 +196,7 @@ impl CLInfo for cl_device_id { + // TODO proper retrival from devices + CL_DEVICE_MEM_BASE_ADDR_ALIGN => cl_prop::(0x1000), + CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE => { +- cl_prop::(size_of::() as cl_uint) ++ cl_prop::(16 * size_of::() as cl_uint) + } + CL_DEVICE_NAME => cl_prop::<&str>(&dev.screen().name()), + CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR => cl_prop::(1), +diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build +index 612e47bfe88e1..1fe75a611444d 100644 +--- a/src/gallium/frontends/rusticl/meson.build ++++ b/src/gallium/frontends/rusticl/meson.build +@@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen( + '--raw-line', 'unsafe impl std::marker::Send for _cl_image_desc {}', + '--raw-line', 'unsafe impl std::marker::Sync for _cl_image_desc {}', + '--allowlist-type', 'cl_.*', ++ '--blocklist-type', '(__)?cl_.*[2348(16)]', + '--allowlist-type', 'cl.*_fn', + '--allowlist-var', 'CL_.*', + # needed for gl_sharing extension +-- +GitLab + From 202dc788ab2d300288f2d3f4d639d34e1c555e3b Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Sat, 31 Aug 2024 12:24:21 +0200 Subject: [PATCH 2/5] lib32-mesa: Fix clang build Signed-off-by: Peter Jung --- mesa/lib32-mesa/.SRCINFO | 6 +- mesa/lib32-mesa/30862.patch | 161 ++++++++++++++++++++++++ mesa/lib32-mesa/PKGBUILD | 14 +-- mesa/lib32-mesa/fix-rusticl-build.patch | 43 +++++++ mesa/lib32-mesa/lib32-clang | 19 +++ 5 files changed, 234 insertions(+), 9 deletions(-) create mode 100644 mesa/lib32-mesa/30862.patch create mode 100644 mesa/lib32-mesa/fix-rusticl-build.patch create mode 100644 mesa/lib32-mesa/lib32-clang diff --git a/mesa/lib32-mesa/.SRCINFO b/mesa/lib32-mesa/.SRCINFO index d2197cc1..dd323966 100644 --- a/mesa/lib32-mesa/.SRCINFO +++ b/mesa/lib32-mesa/.SRCINFO @@ -1,7 +1,7 @@ pkgbase = lib32-mesa pkgdesc = Open-source OpenGL drivers - 32-bit pkgver = 24.2.2 - pkgrel = 3 + pkgrel = 5 epoch = 1 url = https://www.mesa3d.org/ arch = x86_64 @@ -49,11 +49,14 @@ pkgbase = lib32-mesa makedepends = rust-bindgen makedepends = wayland-protocols makedepends = xorgproto + makedepends = lld + makedepends = llvm-libs options = !lto source = https://mesa.freedesktop.org/archive/mesa-24.2.2.tar.xz source = https://mesa.freedesktop.org/archive/mesa-24.2.2.tar.xz.sig source = fix-rusticl-build.patch::https://gitlab.freedesktop.org/mesa/mesa/-/commit/93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch source = https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31122.patch + source = lib32-clang source = ucd-trie-0.1.6.tar.gz::https://crates.io/api/v1/crates/ucd-trie/0.1.6/download source = pest_meta-2.7.11.tar.gz::https://crates.io/api/v1/crates/pest_meta/2.7.11/download source = indexmap-2.2.6.tar.gz::https://crates.io/api/v1/crates/indexmap/2.2.6/download @@ -98,6 +101,7 @@ pkgbase = lib32-mesa b2sums = SKIP b2sums = da196d667e31f647c376c37b394caed7787f4a41d79526ac2177f328920f49d183ef10bdf16b369c00aee4eecc6bc8cd3038908065438d99e58ac97e62c5cbba b2sums = 53d57d8fcfa140e24bec9dbb377f852d4719c0404fc08c3b7a0cca6e0a9b2bfc607bb85126579b00d498283ae2b173fca63982128421151b238aa9051e8754f9 + b2sums = 2b860354deb7af7f96ba5f441e71ab92fd4b5d81f44c27702b4d60c714050a048bd2ee89b83e96a7c08eaea45b530e18822e14580938f178b89cd228ffa5586f b2sums = a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823 b2sums = 9c34f1ab14ad5ae124882513e0f14b1d731d06a43203bdc37fa3b202dd3ce93dbe8ebb554d01bab475689fe6ffd3ec0cbc0d5365c9b984cb83fb34ea3e9e732e b2sums = fac5cf6339dc3c0a40b100035a5c874cc7b2efeafeb31c51488d25156e392dc9db86a497e76eead351d2126f69d060422faa9c55d73407a0de9f5be18d234123 diff --git a/mesa/lib32-mesa/30862.patch b/mesa/lib32-mesa/30862.patch new file mode 100644 index 00000000..f57b5fec --- /dev/null +++ b/mesa/lib32-mesa/30862.patch @@ -0,0 +1,161 @@ +From 85741c6a15de6ed402e0b5a8b2219dbdb83d5c44 Mon Sep 17 00:00:00 2001 +From: Timothy Arceri +Date: Tue, 27 Aug 2024 09:28:41 +1000 +Subject: [PATCH 1/2] nir/tests: make add_loop_terminators more flexible + +Here we update the helper to have an option to add the break to the else +blocks of the terminators. + +Reviewed-by: Konstantin Seurer +Part-of: +--- + src/compiler/nir/tests/opt_loop_tests.cpp | 20 ++++++++++++++------ + 1 file changed, 14 insertions(+), 6 deletions(-) + +diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp +index 0bbf1d043ba35..1fede9a5b49d4 100644 +--- a/src/compiler/nir/tests/opt_loop_tests.cpp ++++ b/src/compiler/nir/tests/opt_loop_tests.cpp +@@ -28,7 +28,7 @@ protected: + nir_opt_loop_test(); + + nir_deref_instr *add_loop_terminators(nir_if **term1, nir_if **term2, +- bool deref_array); ++ bool break_in_else, bool deref_array); + void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, + nir_def *def1, nir_def *def2); + +@@ -52,12 +52,16 @@ nir_opt_loop_test::nir_opt_loop_test() + + nir_deref_instr * + nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, +- bool deref_array) ++ bool break_in_else, bool deref_array) + { + /* Add first terminator */ + nir_def *one = nir_imm_int(b, 1); + nir_def *cmp_result = nir_ieq(b, in_def, one); + nir_if *nif = nir_push_if(b, cmp_result); ++ ++ if (break_in_else) ++ nir_push_else(b, nif); ++ + nir_jump(b, nir_jump_break); + nir_pop_if(b, nif); + +@@ -77,6 +81,10 @@ nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, + nir_def *two = nir_imm_int(b, 2); + nir_def *cmp_result2 = nir_ieq(b, ubo_def, two); + nir_if *nif2 = nir_push_if(b, cmp_result2); ++ ++ if (break_in_else) ++ nir_push_else(b, nif2); ++ + nir_jump(b, nir_jump_break); + nir_pop_if(b, nif2); + +@@ -107,7 +115,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) + */ + nir_loop *loop = nir_push_loop(b); + +- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false); ++ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, false); + + /* Load from deref that will be moved inside the continue branch of the + * first if-statements continue block. If not handled correctly during +@@ -131,7 +139,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_phi_index) + */ + nir_loop *loop = nir_push_loop(b); + +- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, true); ++ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, true); + + /* Load from deref that will be moved inside the continue branch of the + * first if-statements continue block. If not handled correctly during +@@ -160,7 +168,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis) + + nir_if *term1; + nir_if *term2; +- add_loop_terminators(&term1, &term2, false); ++ add_loop_terminators(&term1, &term2, false, false); + + nir_pop_loop(b, loop); + +@@ -188,7 +196,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis_nested_l + + nir_if *term1; + nir_if *term2; +- add_loop_terminators(&term1, &term2, false); ++ add_loop_terminators(&term1, &term2, false, false); + + nir_pop_loop(b, loop); + +-- +GitLab + + +From bb426b7f3c8bece76490737d21eeee4542979ad9 Mon Sep 17 00:00:00 2001 +From: Timothy Arceri +Date: Tue, 27 Aug 2024 11:08:23 +1000 +Subject: [PATCH 2/2] nir/tests: add basic terminator merge test + +Reviewed-by: Konstantin Seurer +Part-of: +--- + src/compiler/nir/tests/opt_loop_tests.cpp | 33 +++++++++++++++++++++++ + 1 file changed, 33 insertions(+) + +diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp +index 1fede9a5b49d4..e797adee1763f 100644 +--- a/src/compiler/nir/tests/opt_loop_tests.cpp ++++ b/src/compiler/nir/tests/opt_loop_tests.cpp +@@ -31,6 +31,7 @@ protected: + bool break_in_else, bool deref_array); + void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, + nir_def *def1, nir_def *def2); ++ void test_merged_if(bool break_in_else); + + nir_def *in_def; + nir_variable *out_var; +@@ -108,6 +109,38 @@ nir_opt_loop_test::create_loop_phis(nir_loop *loop, + &phi_instr->instr); + } + ++void ++nir_opt_loop_test::test_merged_if(bool break_in_else) ++{ ++ /* Tests that opt_loop_merge_terminators results in valid nir and that ++ * the test condition is correct based on the location of the break in ++ * the terminators. ++ */ ++ nir_loop *loop = nir_push_loop(b); ++ ++ nir_if *term1; ++ nir_if *term2; ++ add_loop_terminators(&term1, &term2, break_in_else, false); ++ ++ nir_pop_loop(b, loop); ++ ++ ASSERT_TRUE(nir_opt_loop(b->shader)); ++ ++ nir_validate_shader(b->shader, NULL); ++ ++ nir_alu_instr *alu = nir_instr_as_alu(term2->condition.ssa->parent_instr); ++ if (break_in_else) ++ ASSERT_TRUE(alu->op == nir_op_iand); ++ else ++ ASSERT_TRUE(alu->op == nir_op_ior); ++} ++ ++TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_basic) ++{ ++ test_merged_if(false); ++ test_merged_if(true); ++} ++ + TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) + { + /* Tests that opt_loop_merge_terminators creates valid nir after it merges +-- +GitLab + diff --git a/mesa/lib32-mesa/PKGBUILD b/mesa/lib32-mesa/PKGBUILD index ecc3e295..caa7b30d 100644 --- a/mesa/lib32-mesa/PKGBUILD +++ b/mesa/lib32-mesa/PKGBUILD @@ -23,7 +23,7 @@ pkgname=( lib32-vulkan-virtio ) pkgver=24.2.2 -pkgrel=3 +pkgrel=5 epoch=1 pkgdesc="Open-source OpenGL drivers - 32-bit" url="https://www.mesa3d.org/" @@ -89,6 +89,7 @@ source=( "https://mesa.freedesktop.org/archive/mesa-$pkgver.tar.xz"{,.sig} "fix-rusticl-build.patch::https://gitlab.freedesktop.org/mesa/mesa/-/commit/93e96da9458c9d0348f2390dc0bea67cf140b1a0.patch" "https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/31122.patch" + "lib32-clang" ) validpgpkeys=( 946D09B5E4C9845E63075FF1D961C596A7203456 # Andres Gomez @@ -129,6 +130,7 @@ b2sums=('14b29989b056c3bc76cb64babef6e93dd31af37ea72674adaad3f7ef7373c004996e375 'SKIP' 'da196d667e31f647c376c37b394caed7787f4a41d79526ac2177f328920f49d183ef10bdf16b369c00aee4eecc6bc8cd3038908065438d99e58ac97e62c5cbba' '53d57d8fcfa140e24bec9dbb377f852d4719c0404fc08c3b7a0cca6e0a9b2bfc607bb85126579b00d498283ae2b173fca63982128421151b238aa9051e8754f9' + '2b860354deb7af7f96ba5f441e71ab92fd4b5d81f44c27702b4d60c714050a048bd2ee89b83e96a7c08eaea45b530e18822e14580938f178b89cd228ffa5586f' 'a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823' '9c34f1ab14ad5ae124882513e0f14b1d731d06a43203bdc37fa3b202dd3ce93dbe8ebb554d01bab475689fe6ffd3ec0cbc0d5365c9b984cb83fb34ea3e9e732e' 'fac5cf6339dc3c0a40b100035a5c874cc7b2efeafeb31c51488d25156e392dc9db86a497e76eead351d2126f69d060422faa9c55d73407a0de9f5be18d234123' @@ -183,7 +185,7 @@ prepare() { build() { local meson_options=( - --cross-file lib32 + --cross-file "$srcdir/lib32-clang" -D android-libbacktrace=disabled -D b_ndebug=true -D gallium-drivers=r300,r600,radeonsi,nouveau,virgl,svga,llvmpipe,softpipe,iris,crocus,i915,zink @@ -210,15 +212,11 @@ build() { export BINDGEN_EXTRA_CLANG_ARGS="-m32" # Set Clang as compiler - export AR=llvm-ar - export CC=clang - export CXX=clang++ - export NM=llvm-nm - export RANLIB=llvm-ranlib + export AR=llvm-ar CC=clang CXX=clang++ NM=llvm-nm RANLIB=llvm-ranlib export CFLAGS+=" -flto=thin" export CXXFLAGS+=" -flto=thin" - export LDFLAGS+=" -Wl,--undefined-version -fuse-ld=lld" + export LDFLAGS+=" -fuse-ld=lld" # Build only minimal debug info to reduce size CFLAGS+=" -g1" diff --git a/mesa/lib32-mesa/fix-rusticl-build.patch b/mesa/lib32-mesa/fix-rusticl-build.patch new file mode 100644 index 00000000..fb01363b --- /dev/null +++ b/mesa/lib32-mesa/fix-rusticl-build.patch @@ -0,0 +1,43 @@ +From 93e96da9458c9d0348f2390dc0bea67cf140b1a0 Mon Sep 17 00:00:00 2001 +From: Karol Herbst +Date: Sun, 18 Aug 2024 00:08:50 +0200 +Subject: [PATCH] rusticl: do not use CL vector types in bindings and code + +Bindgen seems to miscompile them and I kinda thought I've done this +already in the past, but apparently not. + +Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11722 +Part-of: +--- + src/gallium/frontends/rusticl/api/device.rs | 2 +- + src/gallium/frontends/rusticl/meson.build | 1 + + 2 files changed, 2 insertions(+), 1 deletion(-) + +diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs +index 9793092db5ad4..c1cb7902e0371 100644 +--- a/src/gallium/frontends/rusticl/api/device.rs ++++ b/src/gallium/frontends/rusticl/api/device.rs +@@ -196,7 +196,7 @@ impl CLInfo for cl_device_id { + // TODO proper retrival from devices + CL_DEVICE_MEM_BASE_ADDR_ALIGN => cl_prop::(0x1000), + CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE => { +- cl_prop::(size_of::() as cl_uint) ++ cl_prop::(16 * size_of::() as cl_uint) + } + CL_DEVICE_NAME => cl_prop::<&str>(&dev.screen().name()), + CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR => cl_prop::(1), +diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build +index 612e47bfe88e1..1fe75a611444d 100644 +--- a/src/gallium/frontends/rusticl/meson.build ++++ b/src/gallium/frontends/rusticl/meson.build +@@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen( + '--raw-line', 'unsafe impl std::marker::Send for _cl_image_desc {}', + '--raw-line', 'unsafe impl std::marker::Sync for _cl_image_desc {}', + '--allowlist-type', 'cl_.*', ++ '--blocklist-type', '(__)?cl_.*[2348(16)]', + '--allowlist-type', 'cl.*_fn', + '--allowlist-var', 'CL_.*', + # needed for gl_sharing extension +-- +GitLab + diff --git a/mesa/lib32-mesa/lib32-clang b/mesa/lib32-mesa/lib32-clang new file mode 100644 index 00000000..92ba7d0a --- /dev/null +++ b/mesa/lib32-mesa/lib32-clang @@ -0,0 +1,19 @@ +[binaries] +c = ['clang', '-m32'] +cpp = ['clang++', '-m32'] +rust = ['rustc', '--target', 'i686-unknown-linux-gnu'] +pkgconfig = 'i686-pc-linux-gnu-pkg-config' +cups-config = 'cups-config' +llvm-config = 'llvm-config32' +strip = 'strip' + +[built-in options] +libdir = 'lib32' + +[host_machine] +system = 'linux' +subsystem = 'linux' +kernel = 'linux' +cpu_family = 'x86' +cpu = 'i686' +endian = 'little' From 7f95d88304f38c1308d656b38ff92d4e91ae43bc Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Sat, 31 Aug 2024 12:24:29 +0200 Subject: [PATCH 3/5] lib32-mesa: Fix clang build Signed-off-by: Peter Jung --- mesa/lib32-mesa/30862.patch | 161 ------------------------ mesa/lib32-mesa/fix-rusticl-build.patch | 43 ------- 2 files changed, 204 deletions(-) delete mode 100644 mesa/lib32-mesa/30862.patch delete mode 100644 mesa/lib32-mesa/fix-rusticl-build.patch diff --git a/mesa/lib32-mesa/30862.patch b/mesa/lib32-mesa/30862.patch deleted file mode 100644 index f57b5fec..00000000 --- a/mesa/lib32-mesa/30862.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 85741c6a15de6ed402e0b5a8b2219dbdb83d5c44 Mon Sep 17 00:00:00 2001 -From: Timothy Arceri -Date: Tue, 27 Aug 2024 09:28:41 +1000 -Subject: [PATCH 1/2] nir/tests: make add_loop_terminators more flexible - -Here we update the helper to have an option to add the break to the else -blocks of the terminators. - -Reviewed-by: Konstantin Seurer -Part-of: ---- - src/compiler/nir/tests/opt_loop_tests.cpp | 20 ++++++++++++++------ - 1 file changed, 14 insertions(+), 6 deletions(-) - -diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp -index 0bbf1d043ba35..1fede9a5b49d4 100644 ---- a/src/compiler/nir/tests/opt_loop_tests.cpp -+++ b/src/compiler/nir/tests/opt_loop_tests.cpp -@@ -28,7 +28,7 @@ protected: - nir_opt_loop_test(); - - nir_deref_instr *add_loop_terminators(nir_if **term1, nir_if **term2, -- bool deref_array); -+ bool break_in_else, bool deref_array); - void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, - nir_def *def1, nir_def *def2); - -@@ -52,12 +52,16 @@ nir_opt_loop_test::nir_opt_loop_test() - - nir_deref_instr * - nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, -- bool deref_array) -+ bool break_in_else, bool deref_array) - { - /* Add first terminator */ - nir_def *one = nir_imm_int(b, 1); - nir_def *cmp_result = nir_ieq(b, in_def, one); - nir_if *nif = nir_push_if(b, cmp_result); -+ -+ if (break_in_else) -+ nir_push_else(b, nif); -+ - nir_jump(b, nir_jump_break); - nir_pop_if(b, nif); - -@@ -77,6 +81,10 @@ nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, - nir_def *two = nir_imm_int(b, 2); - nir_def *cmp_result2 = nir_ieq(b, ubo_def, two); - nir_if *nif2 = nir_push_if(b, cmp_result2); -+ -+ if (break_in_else) -+ nir_push_else(b, nif2); -+ - nir_jump(b, nir_jump_break); - nir_pop_if(b, nif2); - -@@ -107,7 +115,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) - */ - nir_loop *loop = nir_push_loop(b); - -- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false); -+ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, false); - - /* Load from deref that will be moved inside the continue branch of the - * first if-statements continue block. If not handled correctly during -@@ -131,7 +139,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_phi_index) - */ - nir_loop *loop = nir_push_loop(b); - -- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, true); -+ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, true); - - /* Load from deref that will be moved inside the continue branch of the - * first if-statements continue block. If not handled correctly during -@@ -160,7 +168,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis) - - nir_if *term1; - nir_if *term2; -- add_loop_terminators(&term1, &term2, false); -+ add_loop_terminators(&term1, &term2, false, false); - - nir_pop_loop(b, loop); - -@@ -188,7 +196,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis_nested_l - - nir_if *term1; - nir_if *term2; -- add_loop_terminators(&term1, &term2, false); -+ add_loop_terminators(&term1, &term2, false, false); - - nir_pop_loop(b, loop); - --- -GitLab - - -From bb426b7f3c8bece76490737d21eeee4542979ad9 Mon Sep 17 00:00:00 2001 -From: Timothy Arceri -Date: Tue, 27 Aug 2024 11:08:23 +1000 -Subject: [PATCH 2/2] nir/tests: add basic terminator merge test - -Reviewed-by: Konstantin Seurer -Part-of: ---- - src/compiler/nir/tests/opt_loop_tests.cpp | 33 +++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - -diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp -index 1fede9a5b49d4..e797adee1763f 100644 ---- a/src/compiler/nir/tests/opt_loop_tests.cpp -+++ b/src/compiler/nir/tests/opt_loop_tests.cpp -@@ -31,6 +31,7 @@ protected: - bool break_in_else, bool deref_array); - void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, - nir_def *def1, nir_def *def2); -+ void test_merged_if(bool break_in_else); - - nir_def *in_def; - nir_variable *out_var; -@@ -108,6 +109,38 @@ nir_opt_loop_test::create_loop_phis(nir_loop *loop, - &phi_instr->instr); - } - -+void -+nir_opt_loop_test::test_merged_if(bool break_in_else) -+{ -+ /* Tests that opt_loop_merge_terminators results in valid nir and that -+ * the test condition is correct based on the location of the break in -+ * the terminators. -+ */ -+ nir_loop *loop = nir_push_loop(b); -+ -+ nir_if *term1; -+ nir_if *term2; -+ add_loop_terminators(&term1, &term2, break_in_else, false); -+ -+ nir_pop_loop(b, loop); -+ -+ ASSERT_TRUE(nir_opt_loop(b->shader)); -+ -+ nir_validate_shader(b->shader, NULL); -+ -+ nir_alu_instr *alu = nir_instr_as_alu(term2->condition.ssa->parent_instr); -+ if (break_in_else) -+ ASSERT_TRUE(alu->op == nir_op_iand); -+ else -+ ASSERT_TRUE(alu->op == nir_op_ior); -+} -+ -+TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_basic) -+{ -+ test_merged_if(false); -+ test_merged_if(true); -+} -+ - TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) - { - /* Tests that opt_loop_merge_terminators creates valid nir after it merges --- -GitLab - diff --git a/mesa/lib32-mesa/fix-rusticl-build.patch b/mesa/lib32-mesa/fix-rusticl-build.patch deleted file mode 100644 index fb01363b..00000000 --- a/mesa/lib32-mesa/fix-rusticl-build.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 93e96da9458c9d0348f2390dc0bea67cf140b1a0 Mon Sep 17 00:00:00 2001 -From: Karol Herbst -Date: Sun, 18 Aug 2024 00:08:50 +0200 -Subject: [PATCH] rusticl: do not use CL vector types in bindings and code - -Bindgen seems to miscompile them and I kinda thought I've done this -already in the past, but apparently not. - -Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11722 -Part-of: ---- - src/gallium/frontends/rusticl/api/device.rs | 2 +- - src/gallium/frontends/rusticl/meson.build | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs -index 9793092db5ad4..c1cb7902e0371 100644 ---- a/src/gallium/frontends/rusticl/api/device.rs -+++ b/src/gallium/frontends/rusticl/api/device.rs -@@ -196,7 +196,7 @@ impl CLInfo for cl_device_id { - // TODO proper retrival from devices - CL_DEVICE_MEM_BASE_ADDR_ALIGN => cl_prop::(0x1000), - CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE => { -- cl_prop::(size_of::() as cl_uint) -+ cl_prop::(16 * size_of::() as cl_uint) - } - CL_DEVICE_NAME => cl_prop::<&str>(&dev.screen().name()), - CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR => cl_prop::(1), -diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build -index 612e47bfe88e1..1fe75a611444d 100644 ---- a/src/gallium/frontends/rusticl/meson.build -+++ b/src/gallium/frontends/rusticl/meson.build -@@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen( - '--raw-line', 'unsafe impl std::marker::Send for _cl_image_desc {}', - '--raw-line', 'unsafe impl std::marker::Sync for _cl_image_desc {}', - '--allowlist-type', 'cl_.*', -+ '--blocklist-type', '(__)?cl_.*[2348(16)]', - '--allowlist-type', 'cl.*_fn', - '--allowlist-var', 'CL_.*', - # needed for gl_sharing extension --- -GitLab - From 4c41a5c4ebce15b7842d8ee722da8c68fbc17664 Mon Sep 17 00:00:00 2001 From: Peter Jung Date: Sat, 31 Aug 2024 12:28:16 +0200 Subject: [PATCH 4/5] mesa: Restore undefined Signed-off-by: Peter Jung --- mesa/lib32-mesa/PKGBUILD | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mesa/lib32-mesa/PKGBUILD b/mesa/lib32-mesa/PKGBUILD index caa7b30d..0390d579 100644 --- a/mesa/lib32-mesa/PKGBUILD +++ b/mesa/lib32-mesa/PKGBUILD @@ -216,7 +216,7 @@ build() { export CFLAGS+=" -flto=thin" export CXXFLAGS+=" -flto=thin" - export LDFLAGS+=" -fuse-ld=lld" + export LDFLAGS+=" -Wl,--undefined-version -fuse-ld=lld" # Build only minimal debug info to reduce size CFLAGS+=" -g1" From e61ebf449e3fb48f860600109507127e94507b92 Mon Sep 17 00:00:00 2001 From: Eric Naim Date: Sat, 7 Sep 2024 00:49:37 +0800 Subject: [PATCH 5/5] mesa: Delete extra checksum --- mesa/mesa/.SRCINFO | 1 - mesa/mesa/30862.patch | 161 ------------------------------ mesa/mesa/PKGBUILD | 1 - mesa/mesa/fix-rusticl-build.patch | 43 -------- 4 files changed, 206 deletions(-) delete mode 100644 mesa/mesa/30862.patch delete mode 100644 mesa/mesa/fix-rusticl-build.patch diff --git a/mesa/mesa/.SRCINFO b/mesa/mesa/.SRCINFO index 30d34a58..f97c4ad6 100644 --- a/mesa/mesa/.SRCINFO +++ b/mesa/mesa/.SRCINFO @@ -102,7 +102,6 @@ pkgbase = mesa sha256sums = 901fa70d88b9d6c98022e23b4136f9f3e54e4662c3bc1bd1d84a42a9a0f0c1e9 b2sums = 14b29989b056c3bc76cb64babef6e93dd31af37ea72674adaad3f7ef7373c004996e375941662b1c3bbacfd707a21e2e3631a116a841130edfa1bfe3450ae5ab b2sums = SKIP - b2sums = d6d69a2e2bfc83b0a84840dd043c8dd35c4c7af50e532bfd2fbe742dea9d4e2483f0978f06ddf0066a04ad63ddc3076a07193cac7083211eb04594382eb993e2 b2sums = da196d667e31f647c376c37b394caed7787f4a41d79526ac2177f328920f49d183ef10bdf16b369c00aee4eecc6bc8cd3038908065438d99e58ac97e62c5cbba b2sums = 53d57d8fcfa140e24bec9dbb377f852d4719c0404fc08c3b7a0cca6e0a9b2bfc607bb85126579b00d498283ae2b173fca63982128421151b238aa9051e8754f9 b2sums = a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823 diff --git a/mesa/mesa/30862.patch b/mesa/mesa/30862.patch deleted file mode 100644 index f57b5fec..00000000 --- a/mesa/mesa/30862.patch +++ /dev/null @@ -1,161 +0,0 @@ -From 85741c6a15de6ed402e0b5a8b2219dbdb83d5c44 Mon Sep 17 00:00:00 2001 -From: Timothy Arceri -Date: Tue, 27 Aug 2024 09:28:41 +1000 -Subject: [PATCH 1/2] nir/tests: make add_loop_terminators more flexible - -Here we update the helper to have an option to add the break to the else -blocks of the terminators. - -Reviewed-by: Konstantin Seurer -Part-of: ---- - src/compiler/nir/tests/opt_loop_tests.cpp | 20 ++++++++++++++------ - 1 file changed, 14 insertions(+), 6 deletions(-) - -diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp -index 0bbf1d043ba35..1fede9a5b49d4 100644 ---- a/src/compiler/nir/tests/opt_loop_tests.cpp -+++ b/src/compiler/nir/tests/opt_loop_tests.cpp -@@ -28,7 +28,7 @@ protected: - nir_opt_loop_test(); - - nir_deref_instr *add_loop_terminators(nir_if **term1, nir_if **term2, -- bool deref_array); -+ bool break_in_else, bool deref_array); - void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, - nir_def *def1, nir_def *def2); - -@@ -52,12 +52,16 @@ nir_opt_loop_test::nir_opt_loop_test() - - nir_deref_instr * - nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, -- bool deref_array) -+ bool break_in_else, bool deref_array) - { - /* Add first terminator */ - nir_def *one = nir_imm_int(b, 1); - nir_def *cmp_result = nir_ieq(b, in_def, one); - nir_if *nif = nir_push_if(b, cmp_result); -+ -+ if (break_in_else) -+ nir_push_else(b, nif); -+ - nir_jump(b, nir_jump_break); - nir_pop_if(b, nif); - -@@ -77,6 +81,10 @@ nir_opt_loop_test::add_loop_terminators(nir_if **term1, nir_if **term2, - nir_def *two = nir_imm_int(b, 2); - nir_def *cmp_result2 = nir_ieq(b, ubo_def, two); - nir_if *nif2 = nir_push_if(b, cmp_result2); -+ -+ if (break_in_else) -+ nir_push_else(b, nif2); -+ - nir_jump(b, nir_jump_break); - nir_pop_if(b, nif2); - -@@ -107,7 +115,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) - */ - nir_loop *loop = nir_push_loop(b); - -- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false); -+ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, false); - - /* Load from deref that will be moved inside the continue branch of the - * first if-statements continue block. If not handled correctly during -@@ -131,7 +139,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_phi_index) - */ - nir_loop *loop = nir_push_loop(b); - -- nir_deref_instr *deref = add_loop_terminators(NULL, NULL, true); -+ nir_deref_instr *deref = add_loop_terminators(NULL, NULL, false, true); - - /* Load from deref that will be moved inside the continue branch of the - * first if-statements continue block. If not handled correctly during -@@ -160,7 +168,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis) - - nir_if *term1; - nir_if *term2; -- add_loop_terminators(&term1, &term2, false); -+ add_loop_terminators(&term1, &term2, false, false); - - nir_pop_loop(b, loop); - -@@ -188,7 +196,7 @@ TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_skip_merge_if_phis_nested_l - - nir_if *term1; - nir_if *term2; -- add_loop_terminators(&term1, &term2, false); -+ add_loop_terminators(&term1, &term2, false, false); - - nir_pop_loop(b, loop); - --- -GitLab - - -From bb426b7f3c8bece76490737d21eeee4542979ad9 Mon Sep 17 00:00:00 2001 -From: Timothy Arceri -Date: Tue, 27 Aug 2024 11:08:23 +1000 -Subject: [PATCH 2/2] nir/tests: add basic terminator merge test - -Reviewed-by: Konstantin Seurer -Part-of: ---- - src/compiler/nir/tests/opt_loop_tests.cpp | 33 +++++++++++++++++++++++ - 1 file changed, 33 insertions(+) - -diff --git a/src/compiler/nir/tests/opt_loop_tests.cpp b/src/compiler/nir/tests/opt_loop_tests.cpp -index 1fede9a5b49d4..e797adee1763f 100644 ---- a/src/compiler/nir/tests/opt_loop_tests.cpp -+++ b/src/compiler/nir/tests/opt_loop_tests.cpp -@@ -31,6 +31,7 @@ protected: - bool break_in_else, bool deref_array); - void create_loop_phis(nir_loop *loop, nir_if *term1, nir_if *term2, - nir_def *def1, nir_def *def2); -+ void test_merged_if(bool break_in_else); - - nir_def *in_def; - nir_variable *out_var; -@@ -108,6 +109,38 @@ nir_opt_loop_test::create_loop_phis(nir_loop *loop, - &phi_instr->instr); - } - -+void -+nir_opt_loop_test::test_merged_if(bool break_in_else) -+{ -+ /* Tests that opt_loop_merge_terminators results in valid nir and that -+ * the test condition is correct based on the location of the break in -+ * the terminators. -+ */ -+ nir_loop *loop = nir_push_loop(b); -+ -+ nir_if *term1; -+ nir_if *term2; -+ add_loop_terminators(&term1, &term2, break_in_else, false); -+ -+ nir_pop_loop(b, loop); -+ -+ ASSERT_TRUE(nir_opt_loop(b->shader)); -+ -+ nir_validate_shader(b->shader, NULL); -+ -+ nir_alu_instr *alu = nir_instr_as_alu(term2->condition.ssa->parent_instr); -+ if (break_in_else) -+ ASSERT_TRUE(alu->op == nir_op_iand); -+ else -+ ASSERT_TRUE(alu->op == nir_op_ior); -+} -+ -+TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_basic) -+{ -+ test_merged_if(false); -+ test_merged_if(true); -+} -+ - TEST_F(nir_opt_loop_test, opt_loop_merge_terminators_deref_after_first_if) - { - /* Tests that opt_loop_merge_terminators creates valid nir after it merges --- -GitLab - diff --git a/mesa/mesa/PKGBUILD b/mesa/mesa/PKGBUILD index 5ee554f6..5245c113 100644 --- a/mesa/mesa/PKGBUILD +++ b/mesa/mesa/PKGBUILD @@ -139,7 +139,6 @@ done b2sums=('14b29989b056c3bc76cb64babef6e93dd31af37ea72674adaad3f7ef7373c004996e375941662b1c3bbacfd707a21e2e3631a116a841130edfa1bfe3450ae5ab' 'SKIP' - 'd6d69a2e2bfc83b0a84840dd043c8dd35c4c7af50e532bfd2fbe742dea9d4e2483f0978f06ddf0066a04ad63ddc3076a07193cac7083211eb04594382eb993e2' 'da196d667e31f647c376c37b394caed7787f4a41d79526ac2177f328920f49d183ef10bdf16b369c00aee4eecc6bc8cd3038908065438d99e58ac97e62c5cbba' '53d57d8fcfa140e24bec9dbb377f852d4719c0404fc08c3b7a0cca6e0a9b2bfc607bb85126579b00d498283ae2b173fca63982128421151b238aa9051e8754f9' 'a6d47c903be6094423d89b8ec3ca899d0a84df6dbd6e76632bb6c9b9f40ad9c216f8fa400310753d392f85072756b43ac3892e0a2c4d55f87ab6463002554823' diff --git a/mesa/mesa/fix-rusticl-build.patch b/mesa/mesa/fix-rusticl-build.patch deleted file mode 100644 index fb01363b..00000000 --- a/mesa/mesa/fix-rusticl-build.patch +++ /dev/null @@ -1,43 +0,0 @@ -From 93e96da9458c9d0348f2390dc0bea67cf140b1a0 Mon Sep 17 00:00:00 2001 -From: Karol Herbst -Date: Sun, 18 Aug 2024 00:08:50 +0200 -Subject: [PATCH] rusticl: do not use CL vector types in bindings and code - -Bindgen seems to miscompile them and I kinda thought I've done this -already in the past, but apparently not. - -Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/11722 -Part-of: ---- - src/gallium/frontends/rusticl/api/device.rs | 2 +- - src/gallium/frontends/rusticl/meson.build | 1 + - 2 files changed, 2 insertions(+), 1 deletion(-) - -diff --git a/src/gallium/frontends/rusticl/api/device.rs b/src/gallium/frontends/rusticl/api/device.rs -index 9793092db5ad4..c1cb7902e0371 100644 ---- a/src/gallium/frontends/rusticl/api/device.rs -+++ b/src/gallium/frontends/rusticl/api/device.rs -@@ -196,7 +196,7 @@ impl CLInfo for cl_device_id { - // TODO proper retrival from devices - CL_DEVICE_MEM_BASE_ADDR_ALIGN => cl_prop::(0x1000), - CL_DEVICE_MIN_DATA_TYPE_ALIGN_SIZE => { -- cl_prop::(size_of::() as cl_uint) -+ cl_prop::(16 * size_of::() as cl_uint) - } - CL_DEVICE_NAME => cl_prop::<&str>(&dev.screen().name()), - CL_DEVICE_NATIVE_VECTOR_WIDTH_CHAR => cl_prop::(1), -diff --git a/src/gallium/frontends/rusticl/meson.build b/src/gallium/frontends/rusticl/meson.build -index 612e47bfe88e1..1fe75a611444d 100644 ---- a/src/gallium/frontends/rusticl/meson.build -+++ b/src/gallium/frontends/rusticl/meson.build -@@ -146,6 +146,7 @@ rusticl_opencl_bindings_rs = rust.bindgen( - '--raw-line', 'unsafe impl std::marker::Send for _cl_image_desc {}', - '--raw-line', 'unsafe impl std::marker::Sync for _cl_image_desc {}', - '--allowlist-type', 'cl_.*', -+ '--blocklist-type', '(__)?cl_.*[2348(16)]', - '--allowlist-type', 'cl.*_fn', - '--allowlist-var', 'CL_.*', - # needed for gl_sharing extension --- -GitLab -