<div dir="ltr"><div>Can you remove AC_TM_SLP_VECTORIZE and run the pass unconditionally on >= gfx9?</div><div><br></div><div>Thanks,<br></div><div>Marek<br></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Dec 7, 2018 at 12:23 PM Rhys Perry <<a href="mailto:pendingchaos02@gmail.com">pendingchaos02@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Signed-off-by: Rhys Perry <<a href="mailto:pendingchaos02@gmail.com" target="_blank">pendingchaos02@gmail.com</a>><br>
---<br>
 src/amd/common/ac_llvm_util.c | 9 ++++++---<br>
 src/amd/common/ac_llvm_util.h | 1 +<br>
 src/amd/vulkan/radv_shader.c  | 3 +++<br>
 3 files changed, 10 insertions(+), 3 deletions(-)<br>
<br>
diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c<br>
index dc9b684e9d..3219126188 100644<br>
--- a/src/amd/common/ac_llvm_util.c<br>
+++ b/src/amd/common/ac_llvm_util.c<br>
@@ -33,6 +33,7 @@<br>
 #if HAVE_LLVM >= 0x0700<br>
 #include <llvm-c/Transforms/Utils.h><br>
 #endif<br>
+#include <llvm-c/Transforms/Vectorize.h><br>
 #include "c11/threads.h"<br>
 #include "gallivm/lp_bld_misc.h"<br>
 #include "util/u_math.h"<br>
@@ -177,7 +178,7 @@ static LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family,<br>
 }<br>
<br>
 static LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef target_library_info,<br>
-                                           bool check_ir)<br>
+                                           enum ac_target_machine_options tm_options)<br>
 {<br>
        LLVMPassManagerRef passmgr = LLVMCreatePassManager();<br>
        if (!passmgr)<br>
@@ -187,7 +188,7 @@ static LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef target_libr<br>
                LLVMAddTargetLibraryInfo(target_library_info,<br>
                                         passmgr);<br>
<br>
-       if (check_ir)<br>
+       if (tm_options & AC_TM_CHECK_IR)<br>
                LLVMAddVerifierPass(passmgr);<br>
        LLVMAddAlwaysInlinerPass(passmgr);<br>
        /* Normally, the pass manager runs all passes on one function before<br>
@@ -203,6 +204,8 @@ static LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef target_libr<br>
        LLVMAddLICMPass(passmgr);<br>
        LLVMAddAggressiveDCEPass(passmgr);<br>
        LLVMAddCFGSimplificationPass(passmgr);<br>
+       if (tm_options & AC_TM_SLP_VECTORIZE)<br>
+               LLVMAddSLPVectorizePass(passmgr);<br>
        /* This is recommended by the instruction combining pass. */<br>
        LLVMAddEarlyCSEMemSSAPass(passmgr);<br>
        LLVMAddInstructionCombiningPass(passmgr);<br>
@@ -332,7 +335,7 @@ ac_init_llvm_compiler(struct ac_llvm_compiler *compiler,<br>
        }<br>
<br>
        compiler->passmgr = ac_create_passmgr(compiler->target_library_info,<br>
-                                             tm_options & AC_TM_CHECK_IR);<br>
+                                             tm_options);<br>
        if (!compiler->passmgr)<br>
                goto fail;<br>
<br>
diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h<br>
index eaf5f21876..35b12c6c6c 100644<br>
--- a/src/amd/common/ac_llvm_util.h<br>
+++ b/src/amd/common/ac_llvm_util.h<br>
@@ -65,6 +65,7 @@ enum ac_target_machine_options {<br>
        AC_TM_CHECK_IR = (1 << 5),<br>
        AC_TM_ENABLE_GLOBAL_ISEL = (1 << 6),<br>
        AC_TM_CREATE_LOW_OPT = (1 << 7),<br>
+       AC_TM_SLP_VECTORIZE = (1 << 8),<br>
 };<br>
<br>
 enum ac_float_mode {<br>
diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c<br>
index 9ba20ac72e..a2ddf17680 100644<br>
--- a/src/amd/vulkan/radv_shader.c<br>
+++ b/src/amd/vulkan/radv_shader.c<br>
@@ -598,6 +598,9 @@ shader_variant_create(struct radv_device *device,<br>
                tm_options |= AC_TM_SISCHED;<br>
        if (options->check_ir)<br>
                tm_options |= AC_TM_CHECK_IR;<br>
+       /* vectorization is disabled on pre-GFX9 because it's not very useful there */<br>
+       if (device->physical_device->rad_info.chip_class >= GFX9)<br>
+               tm_options |= AC_TM_SLP_VECTORIZE;<br>
<br>
        thread_compiler = !(device->instance->debug_flags & RADV_DEBUG_NOTHREADLLVM);<br>
        radv_init_llvm_once();<br>
-- <br>
2.19.2<br>
<br>
_______________________________________________<br>
mesa-dev mailing list<br>
<a href="mailto:mesa-dev@lists.freedesktop.org" target="_blank">mesa-dev@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/mesa-dev" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/mesa-dev</a><br>
</blockquote></div>