[Mesa-dev] [PATCH 35/38] ac,radv: run LLVM's SLP vectorizer
Marek Olšák
maraeo at gmail.com
Tue Dec 18 07:52:34 UTC 2018
Can you remove AC_TM_SLP_VECTORIZE and run the pass unconditionally on >=
gfx9?
Thanks,
Marek
On Fri, Dec 7, 2018 at 12:23 PM Rhys Perry <pendingchaos02 at gmail.com> wrote:
> Signed-off-by: Rhys Perry <pendingchaos02 at gmail.com>
> ---
> src/amd/common/ac_llvm_util.c | 9 ++++++---
> src/amd/common/ac_llvm_util.h | 1 +
> src/amd/vulkan/radv_shader.c | 3 +++
> 3 files changed, 10 insertions(+), 3 deletions(-)
>
> diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
> index dc9b684e9d..3219126188 100644
> --- a/src/amd/common/ac_llvm_util.c
> +++ b/src/amd/common/ac_llvm_util.c
> @@ -33,6 +33,7 @@
> #if HAVE_LLVM >= 0x0700
> #include <llvm-c/Transforms/Utils.h>
> #endif
> +#include <llvm-c/Transforms/Vectorize.h>
> #include "c11/threads.h"
> #include "gallivm/lp_bld_misc.h"
> #include "util/u_math.h"
> @@ -177,7 +178,7 @@ static LLVMTargetMachineRef
> ac_create_target_machine(enum radeon_family family,
> }
>
> static LLVMPassManagerRef ac_create_passmgr(LLVMTargetLibraryInfoRef
> target_library_info,
> - bool check_ir)
> + enum ac_target_machine_options
> tm_options)
> {
> LLVMPassManagerRef passmgr = LLVMCreatePassManager();
> if (!passmgr)
> @@ -187,7 +188,7 @@ static LLVMPassManagerRef
> ac_create_passmgr(LLVMTargetLibraryInfoRef target_libr
> LLVMAddTargetLibraryInfo(target_library_info,
> passmgr);
>
> - if (check_ir)
> + if (tm_options & AC_TM_CHECK_IR)
> LLVMAddVerifierPass(passmgr);
> LLVMAddAlwaysInlinerPass(passmgr);
> /* Normally, the pass manager runs all passes on one function
> before
> @@ -203,6 +204,8 @@ static LLVMPassManagerRef
> ac_create_passmgr(LLVMTargetLibraryInfoRef target_libr
> LLVMAddLICMPass(passmgr);
> LLVMAddAggressiveDCEPass(passmgr);
> LLVMAddCFGSimplificationPass(passmgr);
> + if (tm_options & AC_TM_SLP_VECTORIZE)
> + LLVMAddSLPVectorizePass(passmgr);
> /* This is recommended by the instruction combining pass. */
> LLVMAddEarlyCSEMemSSAPass(passmgr);
> LLVMAddInstructionCombiningPass(passmgr);
> @@ -332,7 +335,7 @@ ac_init_llvm_compiler(struct ac_llvm_compiler
> *compiler,
> }
>
> compiler->passmgr =
> ac_create_passmgr(compiler->target_library_info,
> - tm_options & AC_TM_CHECK_IR);
> + tm_options);
> if (!compiler->passmgr)
> goto fail;
>
> diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
> index eaf5f21876..35b12c6c6c 100644
> --- a/src/amd/common/ac_llvm_util.h
> +++ b/src/amd/common/ac_llvm_util.h
> @@ -65,6 +65,7 @@ enum ac_target_machine_options {
> AC_TM_CHECK_IR = (1 << 5),
> AC_TM_ENABLE_GLOBAL_ISEL = (1 << 6),
> AC_TM_CREATE_LOW_OPT = (1 << 7),
> + AC_TM_SLP_VECTORIZE = (1 << 8),
> };
>
> enum ac_float_mode {
> diff --git a/src/amd/vulkan/radv_shader.c b/src/amd/vulkan/radv_shader.c
> index 9ba20ac72e..a2ddf17680 100644
> --- a/src/amd/vulkan/radv_shader.c
> +++ b/src/amd/vulkan/radv_shader.c
> @@ -598,6 +598,9 @@ shader_variant_create(struct radv_device *device,
> tm_options |= AC_TM_SISCHED;
> if (options->check_ir)
> tm_options |= AC_TM_CHECK_IR;
> + /* vectorization is disabled on pre-GFX9 because it's not very
> useful there */
> + if (device->physical_device->rad_info.chip_class >= GFX9)
> + tm_options |= AC_TM_SLP_VECTORIZE;
>
> thread_compiler = !(device->instance->debug_flags &
> RADV_DEBUG_NOTHREADLLVM);
> radv_init_llvm_once();
> --
> 2.19.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20181218/4620f5b1/attachment.html>
More information about the mesa-dev
mailing list