[Mesa-dev] [PATCH 1/4] ac/radv: change api to create target machine
Bas Nieuwenhuizen
bas at basnieuwenhuizen.nl
Thu Jul 6 07:17:34 UTC 2017
Series is
Reviewed-by: Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
On Thu, Jul 6, 2017 at 4:09 AM, Dave Airlie <airlied at gmail.com> wrote:
> From: Dave Airlie <airlied at redhat.com>
>
> This just modifies the API to make it easier to add other flags
> to target machine creation.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
> src/amd/common/ac_llvm_util.c | 4 ++--
> src/amd/common/ac_llvm_util.h | 5 ++++-
> src/amd/vulkan/radv_pipeline.c | 12 ++++++++----
> 3 files changed, 14 insertions(+), 7 deletions(-)
>
> diff --git a/src/amd/common/ac_llvm_util.c b/src/amd/common/ac_llvm_util.c
> index d9d8d91..088f01f 100644
> --- a/src/amd/common/ac_llvm_util.c
> +++ b/src/amd/common/ac_llvm_util.c
> @@ -118,11 +118,11 @@ static const char *ac_get_llvm_processor_name(enum radeon_family family)
> }
> }
>
> -LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, bool supports_spill)
> +LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options)
> {
> assert(family >= CHIP_TAHITI);
>
> - const char *triple = supports_spill ? "amdgcn-mesa-mesa3d" : "amdgcn--";
> + const char *triple = (tm_options & AC_TM_SUPPORTS_SPILL) ? "amdgcn-mesa-mesa3d" : "amdgcn--";
> LLVMTargetRef target = ac_get_llvm_target(triple);
> LLVMTargetMachineRef tm = LLVMCreateTargetMachine(
> target,
> diff --git a/src/amd/common/ac_llvm_util.h b/src/amd/common/ac_llvm_util.h
> index 4ce59ec..06208a4 100644
> --- a/src/amd/common/ac_llvm_util.h
> +++ b/src/amd/common/ac_llvm_util.h
> @@ -54,7 +54,10 @@ enum ac_func_attr {
> AC_FUNC_ATTR_LEGACY = (1u << 31),
> };
>
> -LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, bool supports_spill);
> +enum ac_target_machine_options {
> + AC_TM_SUPPORTS_SPILL = (1 << 0),
> +};
> +LLVMTargetMachineRef ac_create_target_machine(enum radeon_family family, enum ac_target_machine_options tm_options);
>
> void ac_add_attr_dereferenceable(LLVMValueRef val, uint64_t bytes);
> bool ac_is_sgpr_param(LLVMValueRef param);
> diff --git a/src/amd/vulkan/radv_pipeline.c b/src/amd/vulkan/radv_pipeline.c
> index 061121b..71a5cce 100644
> --- a/src/amd/vulkan/radv_pipeline.c
> +++ b/src/amd/vulkan/radv_pipeline.c
> @@ -460,12 +460,14 @@ static struct radv_shader_variant *radv_shader_variant_create(struct radv_device
> options.key = *key;
>
> struct ac_shader_binary binary;
> -
> + enum ac_target_machine_options tm_options = 0;
> options.unsafe_math = !!(device->debug_flags & RADV_DEBUG_UNSAFE_MATH);
> options.family = chip_family;
> options.chip_class = device->physical_device->rad_info.chip_class;
> options.supports_spill = device->llvm_supports_spill;
> - tm = ac_create_target_machine(chip_family, options.supports_spill);
> + if (options.supports_spill)
> + tm_options |= AC_TM_SUPPORTS_SPILL;
> + tm = ac_create_target_machine(chip_family, tm_options);
> ac_compile_nir_shader(tm, &binary, &variant->config,
> &variant->info, shader, &options, dump);
> LLVMDisposeTargetMachine(tm);
> @@ -501,10 +503,12 @@ radv_pipeline_create_gs_copy_shader(struct radv_pipeline *pipeline,
>
> struct ac_nir_compiler_options options = {0};
> struct ac_shader_binary binary;
> + enum ac_target_machine_options tm_options = 0;
> options.family = chip_family;
> options.chip_class = pipeline->device->physical_device->rad_info.chip_class;
> - options.supports_spill = pipeline->device->llvm_supports_spill;
> - tm = ac_create_target_machine(chip_family, options.supports_spill);
> + if (options.supports_spill)
> + tm_options |= AC_TM_SUPPORTS_SPILL;
> + tm = ac_create_target_machine(chip_family, tm_options);
> ac_create_gs_copy_shader(tm, nir, &binary, &variant->config, &variant->info, &options, dump_shader);
> LLVMDisposeTargetMachine(tm);
>
> --
> 2.9.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
More information about the mesa-dev
mailing list