[Mesa-dev] [PATCH] ac: fix WAITCNT flags for GFX9
Samuel Pitoiset
samuel.pitoiset at gmail.com
Wed Aug 22 07:19:54 UTC 2018
Thanks!
Reviewed-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
On 8/22/18 3:19 AM, Marek Olšák wrote:
> From: Marek Olšák <marek.olsak at amd.com>
>
> ---
> src/amd/common/ac_llvm_build.h | 6 ++++++
> src/amd/common/ac_nir_to_llvm.c | 4 ----
> src/gallium/drivers/radeonsi/si_shader_internal.h | 5 -----
> 3 files changed, 6 insertions(+), 9 deletions(-)
>
> diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h
> index d11a6ebb1be..b080cca4cb7 100644
> --- a/src/amd/common/ac_llvm_build.h
> +++ b/src/amd/common/ac_llvm_build.h
> @@ -36,20 +36,26 @@ extern "C" {
>
> #define HAVE_32BIT_POINTERS (HAVE_LLVM >= 0x0700)
>
> enum {
> /* CONST is the only address space that selects SMEM loads */
> AC_CONST_ADDR_SPACE = HAVE_LLVM >= 0x700 ? 4 : 2,
> AC_LOCAL_ADDR_SPACE = 3,
> AC_CONST_32BIT_ADDR_SPACE = 6, /* same as CONST, but the pointer type has 32 bits */
> };
>
> +/* Combine these with & instead of |. */
> +#define NOOP_WAITCNT 0xcf7f
> +#define LGKM_CNT 0xc07f
> +#define EXP_CNT 0xcf0f
> +#define VM_CNT 0x0f70 /* On GFX9, vmcnt has 6 bits in [0:3] and [14:15] */
> +
> struct ac_llvm_flow;
>
> struct ac_llvm_context {
> LLVMContextRef context;
> LLVMModuleRef module;
> LLVMBuilderRef builder;
>
> LLVMTypeRef voidt;
> LLVMTypeRef i1;
> LLVMTypeRef i8;
> diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
> index 700e48e14b7..bfe35e4671b 100644
> --- a/src/amd/common/ac_nir_to_llvm.c
> +++ b/src/amd/common/ac_nir_to_llvm.c
> @@ -2528,24 +2528,20 @@ static LLVMValueRef visit_image_size(struct ac_nir_context *ctx,
> glsl_get_sampler_dim(type) == GLSL_SAMPLER_DIM_1D &&
> glsl_sampler_type_is_array(type)) {
> LLVMValueRef layers = LLVMBuildExtractElement(ctx->ac.builder, res, two, "");
> res = LLVMBuildInsertElement(ctx->ac.builder, res, layers,
> ctx->ac.i32_1, "");
>
> }
> return res;
> }
>
> -#define NOOP_WAITCNT 0xf7f
> -#define LGKM_CNT 0x07f
> -#define VM_CNT 0xf70
> -
> static void emit_membar(struct ac_llvm_context *ac,
> const nir_intrinsic_instr *instr)
> {
> unsigned waitcnt = NOOP_WAITCNT;
>
> switch (instr->intrinsic) {
> case nir_intrinsic_memory_barrier:
> case nir_intrinsic_group_memory_barrier:
> waitcnt &= VM_CNT & LGKM_CNT;
> break;
> diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
> index ac7784f7d46..aff7e0472db 100644
> --- a/src/gallium/drivers/radeonsi/si_shader_internal.h
> +++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
> @@ -281,25 +281,20 @@ LLVMValueRef si_llvm_load_input_gs(struct ac_shader_abi *abi,
> LLVMValueRef si_nir_lookup_interp_param(struct ac_shader_abi *abi,
> enum glsl_interp_mode interp,
> unsigned location);
>
> void si_llvm_emit_store(struct lp_build_tgsi_context *bld_base,
> const struct tgsi_full_instruction *inst,
> const struct tgsi_opcode_info *info,
> unsigned index,
> LLVMValueRef dst[4]);
>
> -/* Combine these with & instead of |. */
> -#define NOOP_WAITCNT 0xf7f
> -#define LGKM_CNT 0x07f
> -#define VM_CNT 0xf70
> -
> LLVMValueRef si_get_indirect_index(struct si_shader_context *ctx,
> const struct tgsi_ind_register *ind,
> unsigned addr_mul, int rel_index);
> LLVMValueRef si_get_bounded_indirect_index(struct si_shader_context *ctx,
> const struct tgsi_ind_register *ind,
> int rel_index, unsigned num);
> LLVMValueRef si_get_sample_id(struct si_shader_context *ctx);
>
> void si_shader_context_init_alu(struct lp_build_tgsi_context *bld_base);
> void si_shader_context_init_mem(struct si_shader_context *ctx);
>
More information about the mesa-dev
mailing list