[Mesa-dev] [PATCH 02/11] ac/radeonsi: add workgroup_ids to the abi
Timothy Arceri
tarceri at itsqueeze.com
Fri Feb 2 04:03:40 UTC 2018
---
src/amd/common/ac_nir_to_llvm.c | 9 ++++-----
src/amd/common/ac_shader_abi.h | 1 +
src/gallium/drivers/radeonsi/si_shader.c | 9 ++++-----
src/gallium/drivers/radeonsi/si_shader_internal.h | 1 -
4 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/src/amd/common/ac_nir_to_llvm.c b/src/amd/common/ac_nir_to_llvm.c
index fd5989389b..60702d47d3 100644
--- a/src/amd/common/ac_nir_to_llvm.c
+++ b/src/amd/common/ac_nir_to_llvm.c
@@ -91,7 +91,6 @@ struct nir_to_llvm_context {
LLVMValueRef push_constants;
LLVMValueRef view_index;
LLVMValueRef num_work_groups;
- LLVMValueRef workgroup_ids[3];
LLVMValueRef local_invocation_ids;
LLVMValueRef tg_size;
@@ -786,10 +785,10 @@ static void create_function(struct nir_to_llvm_context *ctx,
}
for (int i = 0; i < 3; i++) {
- ctx->workgroup_ids[i] = NULL;
+ ctx->abi.workgroup_ids[i] = NULL;
if (ctx->shader_info->info.cs.uses_block_id[i]) {
add_arg(&args, ARG_SGPR, ctx->ac.i32,
- &ctx->workgroup_ids[i]);
+ &ctx->abi.workgroup_ids[i]);
}
}
@@ -4308,8 +4307,8 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
LLVMValueRef values[3];
for (int i = 0; i < 3; i++) {
- values[i] = ctx->nctx->workgroup_ids[i] ?
- ctx->nctx->workgroup_ids[i] : ctx->ac.i32_0;
+ values[i] = ctx->abi->workgroup_ids[i] ?
+ ctx->abi->workgroup_ids[i] : ctx->ac.i32_0;
}
result = ac_build_gather_values(&ctx->ac, values, 3);
diff --git a/src/amd/common/ac_shader_abi.h b/src/amd/common/ac_shader_abi.h
index d9bb5a1e32..3d3dcc2e8e 100644
--- a/src/amd/common/ac_shader_abi.h
+++ b/src/amd/common/ac_shader_abi.h
@@ -54,6 +54,7 @@ struct ac_shader_abi {
LLVMValueRef ancillary;
LLVMValueRef sample_coverage;
LLVMValueRef prim_mask;
+ LLVMValueRef workgroup_ids[3];
/* For VS and PS: pre-loaded shader inputs.
*
diff --git a/src/gallium/drivers/radeonsi/si_shader.c b/src/gallium/drivers/radeonsi/si_shader.c
index 76215b318a..5b420edf5c 100644
--- a/src/gallium/drivers/radeonsi/si_shader.c
+++ b/src/gallium/drivers/radeonsi/si_shader.c
@@ -2145,9 +2145,8 @@ void si_load_system_value(struct si_shader_context *ctx,
for (int i = 0; i < 3; i++) {
values[i] = ctx->i32_0;
- if (ctx->param_block_id[i] >= 0) {
- values[i] = LLVMGetParam(ctx->main_fn,
- ctx->param_block_id[i]);
+ if (ctx->abi.workgroup_ids[i]) {
+ values[i] = ctx->abi.workgroup_ids[i];
}
}
value = lp_build_gather_values(&ctx->gallivm, values, 3);
@@ -4949,9 +4948,9 @@ static void create_function(struct si_shader_context *ctx)
ctx->param_block_size = add_arg(&fninfo, ARG_SGPR, v3i32);
for (i = 0; i < 3; i++) {
- ctx->param_block_id[i] = -1;
+ ctx->abi.workgroup_ids[i] = NULL;
if (shader->selector->info.uses_block_id[i])
- ctx->param_block_id[i] = add_arg(&fninfo, ARG_SGPR, ctx->i32);
+ add_arg_assign(&fninfo, ARG_SGPR, ctx->i32, &ctx->abi.workgroup_ids[i]);
}
ctx->param_thread_id = add_arg(&fninfo, ARG_VGPR, v3i32);
diff --git a/src/gallium/drivers/radeonsi/si_shader_internal.h b/src/gallium/drivers/radeonsi/si_shader_internal.h
index 489c468f03..202778e04d 100644
--- a/src/gallium/drivers/radeonsi/si_shader_internal.h
+++ b/src/gallium/drivers/radeonsi/si_shader_internal.h
@@ -186,7 +186,6 @@ struct si_shader_context {
/* CS */
int param_grid_size;
int param_block_size;
- int param_block_id[3];
int param_thread_id;
LLVMTargetMachineRef tm;
--
2.14.3
More information about the mesa-dev
mailing list