diff options
author | Marek Olšák <[email protected]> | 2018-09-07 18:44:54 -0400 |
---|---|---|
committer | Marek Olšák <[email protected]> | 2018-10-06 21:50:09 -0400 |
commit | a668c8d6ba981b3439fad0d07ce7a22b5a49b967 (patch) | |
tree | 9eb722428f56a248b3beb437936e83fd0d909b21 | |
parent | 8f77156c268356baf9df8490c52cc5d8475b9db8 (diff) |
ac: define all address spaces properly
-rw-r--r-- | src/amd/common/ac_llvm_build.c | 10 | ||||
-rw-r--r-- | src/amd/common/ac_llvm_build.h | 10 | ||||
-rw-r--r-- | src/amd/common/ac_nir_to_llvm.c | 2 | ||||
-rw-r--r-- | src/amd/vulkan/radv_nir_to_llvm.c | 2 | ||||
-rw-r--r-- | src/gallium/drivers/radeonsi/si_shader.c | 6 |
5 files changed, 16 insertions, 14 deletions
diff --git a/src/amd/common/ac_llvm_build.c b/src/amd/common/ac_llvm_build.c index ab0ba09c83a..93bd35239b2 100644 --- a/src/amd/common/ac_llvm_build.c +++ b/src/amd/common/ac_llvm_build.c @@ -184,7 +184,7 @@ ac_get_type_size(LLVMTypeRef type) case LLVMDoubleTypeKind: return 8; case LLVMPointerTypeKind: - if (LLVMGetPointerAddressSpace(type) == AC_CONST_32BIT_ADDR_SPACE) + if (LLVMGetPointerAddressSpace(type) == AC_ADDR_SPACE_CONST_32BIT) return 4; return 8; case LLVMVectorTypeKind: @@ -891,7 +891,7 @@ ac_build_load_custom(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef indices[2] = {ctx->i32_0, index}; if (no_unsigned_wraparound && - LLVMGetPointerAddressSpace(LLVMTypeOf(base_ptr)) == AC_CONST_32BIT_ADDR_SPACE) + LLVMGetPointerAddressSpace(LLVMTypeOf(base_ptr)) == AC_ADDR_SPACE_CONST_32BIT) pointer = LLVMBuildInBoundsGEP(ctx->builder, base_ptr, indices, 2, ""); else pointer = LLVMBuildGEP(ctx->builder, base_ptr, indices, 2, ""); @@ -2482,7 +2482,7 @@ void ac_declare_lds_as_pointer(struct ac_llvm_context *ctx) { unsigned lds_size = ctx->chip_class >= CIK ? 65536 : 32768; ctx->lds = LLVMBuildIntToPtr(ctx->builder, ctx->i32_0, - LLVMPointerType(LLVMArrayType(ctx->i32, lds_size / 4), AC_LOCAL_ADDR_SPACE), + LLVMPointerType(LLVMArrayType(ctx->i32, lds_size / 4), AC_ADDR_SPACE_LDS), "lds"); } @@ -2564,7 +2564,7 @@ LLVMValueRef ac_find_lsb(struct ac_llvm_context *ctx, LLVMTypeRef ac_array_in_const_addr_space(LLVMTypeRef elem_type) { return LLVMPointerType(LLVMArrayType(elem_type, 0), - AC_CONST_ADDR_SPACE); + AC_ADDR_SPACE_CONST); } LLVMTypeRef ac_array_in_const32_addr_space(LLVMTypeRef elem_type) @@ -2573,7 +2573,7 @@ LLVMTypeRef ac_array_in_const32_addr_space(LLVMTypeRef elem_type) return ac_array_in_const_addr_space(elem_type); return LLVMPointerType(LLVMArrayType(elem_type, 0), - AC_CONST_32BIT_ADDR_SPACE); + AC_ADDR_SPACE_CONST_32BIT); } static struct ac_llvm_flow * diff --git a/src/amd/common/ac_llvm_build.h b/src/amd/common/ac_llvm_build.h index 0df9234c664..73f8a6b70cd 100644 --- a/src/amd/common/ac_llvm_build.h +++ b/src/amd/common/ac_llvm_build.h @@ -37,10 +37,12 @@ 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 */ + AC_ADDR_SPACE_FLAT = HAVE_LLVM >= 0x0700 ? 0 : 4, /* Slower than global. */ + AC_ADDR_SPACE_GLOBAL = 1, + AC_ADDR_SPACE_GDS = HAVE_LLVM >= 0x0700 ? 2 : 5, + AC_ADDR_SPACE_LDS = 3, + AC_ADDR_SPACE_CONST = HAVE_LLVM >= 0x0700 ? 4 : 2, /* Global allowing SMEM. */ + AC_ADDR_SPACE_CONST_32BIT = 6, /* same as CONST, but the pointer type has 32 bits */ }; /* Combine these with & instead of |. */ diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c index b01309cc2a9..312383db36c 100644 --- a/src/amd/common/ac_nir_to_llvm.c +++ b/src/amd/common/ac_nir_to_llvm.c @@ -3928,7 +3928,7 @@ setup_shared(struct ac_nir_context *ctx, LLVMAddGlobalInAddressSpace( ctx->ac.module, glsl_to_llvm_type(&ctx->ac, variable->type), variable->name ? variable->name : "", - AC_LOCAL_ADDR_SPACE); + AC_ADDR_SPACE_LDS); _mesa_hash_table_insert(ctx->vars, variable, shared); } } diff --git a/src/amd/vulkan/radv_nir_to_llvm.c b/src/amd/vulkan/radv_nir_to_llvm.c index 32d347ebd0f..b2f04d029b7 100644 --- a/src/amd/vulkan/radv_nir_to_llvm.c +++ b/src/amd/vulkan/radv_nir_to_llvm.c @@ -1136,7 +1136,7 @@ static void create_function(struct radv_shader_context *ctx, &user_sgpr_idx); if (ctx->options->supports_spill) { ctx->ring_offsets = ac_build_intrinsic(&ctx->ac, "llvm.amdgcn.implicit.buffer.ptr", - LLVMPointerType(ctx->ac.i8, AC_CONST_ADDR_SPACE), + LLVMPointerType(ctx->ac.i8, AC_ADDR_SPACE_CONST), NULL, 0, AC_FUNC_ATTR_READNONE); ctx->ring_offsets = LLVMBuildBitCast(ctx->ac.builder, ctx->ring_offsets, ac_array_in_const_addr_space(ctx->ac.v4i32), ""); diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c index fedc616ebf6..acd4d34f899 100644 --- a/src/gallium/drivers/radeonsi/si_shader.c +++ b/src/gallium/drivers/radeonsi/si_shader.c @@ -2287,7 +2287,7 @@ void si_declare_compute_memory(struct si_shader_context *ctx) struct si_shader_selector *sel = ctx->shader->selector; unsigned lds_size = sel->info.properties[TGSI_PROPERTY_CS_LOCAL_SIZE]; - LLVMTypeRef i8p = LLVMPointerType(ctx->i8, AC_LOCAL_ADDR_SPACE); + LLVMTypeRef i8p = LLVMPointerType(ctx->i8, AC_ADDR_SPACE_LDS); LLVMValueRef var; assert(!ctx->ac.lds); @@ -2295,7 +2295,7 @@ void si_declare_compute_memory(struct si_shader_context *ctx) var = LLVMAddGlobalInAddressSpace(ctx->ac.module, LLVMArrayType(ctx->i8, lds_size), "compute_lds", - AC_LOCAL_ADDR_SPACE); + AC_ADDR_SPACE_LDS); LLVMSetAlignment(var, 4); ctx->ac.lds = LLVMBuildBitCast(ctx->ac.builder, var, i8p, ""); @@ -6669,7 +6669,7 @@ static void si_build_wrapper_function(struct si_shader_context *ctx, if (LLVMTypeOf(arg) != param_type) { if (LLVMGetTypeKind(param_type) == LLVMPointerTypeKind) { if (LLVMGetPointerAddressSpace(param_type) == - AC_CONST_32BIT_ADDR_SPACE) { + AC_ADDR_SPACE_CONST_32BIT) { arg = LLVMBuildBitCast(builder, arg, ctx->i32, ""); arg = LLVMBuildIntToPtr(builder, arg, param_type, ""); } else { |