ac: use amdgpu-flat-work-group-size

Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl>
This commit is contained in:
Marek Olšák
2019-05-31 15:38:39 -04:00
parent 4b11ed443b
commit 486bc1e17e
4 changed files with 15 additions and 10 deletions

View File

@@ -269,6 +269,16 @@ ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
LLVMAddTargetDependentFunctionAttr(F, name, str); LLVMAddTargetDependentFunctionAttr(F, name, str);
} }
void ac_llvm_set_workgroup_size(LLVMValueRef F, unsigned size)
{
if (!size)
return;
char str[32];
snprintf(str, sizeof(str), "%u,%u", size, size);
LLVMAddTargetDependentFunctionAttr(F, "amdgpu-flat-work-group-size", str);
}
unsigned unsigned
ac_count_scratch_private_memory(LLVMValueRef function) ac_count_scratch_private_memory(LLVMValueRef function)
{ {

View File

@@ -109,6 +109,7 @@ LLVMBuilderRef ac_create_builder(LLVMContextRef ctx,
void void
ac_llvm_add_target_dep_function_attr(LLVMValueRef F, ac_llvm_add_target_dep_function_attr(LLVMValueRef F,
const char *name, unsigned value); const char *name, unsigned value);
void ac_llvm_set_workgroup_size(LLVMValueRef F, unsigned size);
static inline unsigned static inline unsigned
ac_get_load_intr_attribs(bool can_speculate) ac_get_load_intr_attribs(bool can_speculate)

View File

@@ -518,11 +518,8 @@ create_llvm_function(LLVMContextRef ctx, LLVMModuleRef module,
options->address32_hi); options->address32_hi);
} }
if (max_workgroup_size) { ac_llvm_set_workgroup_size(main_function, max_workgroup_size);
ac_llvm_add_target_dep_function_attr(main_function,
"amdgpu-max-work-group-size",
max_workgroup_size);
}
if (options->unsafe_math) { if (options->unsafe_math) {
/* These were copied from some LLVM test. */ /* These were copied from some LLVM test. */
LLVMAddTargetDependentFunctionAttr(main_function, LLVMAddTargetDependentFunctionAttr(main_function,

View File

@@ -4307,11 +4307,8 @@ void si_create_function(struct si_shader_context *ctx,
ctx->screen->info.address32_hi); ctx->screen->info.address32_hi);
} }
if (max_workgroup_size) { ac_llvm_set_workgroup_size(ctx->main_fn, max_workgroup_size);
ac_llvm_add_target_dep_function_attr(ctx->main_fn,
"amdgpu-max-work-group-size",
max_workgroup_size);
}
LLVMAddTargetDependentFunctionAttr(ctx->main_fn, LLVMAddTargetDependentFunctionAttr(ctx->main_fn,
"no-signed-zeros-fp-math", "no-signed-zeros-fp-math",
"true"); "true");