gallivm: convert block_id to discrete values.

There is no reason to stick these in a vector

Reviewed-by: Mike Blumenkrantz <michael.blumenkrantz@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/23997>
This commit is contained in:
Dave Airlie
2023-07-05 10:16:59 +10:00
parent bcb5dbf232
commit e021973f5a
4 changed files with 6 additions and 7 deletions
@@ -1924,7 +1924,7 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
case nir_intrinsic_load_workgroup_id: {
LLVMValueRef tmp[3];
for (unsigned i = 0; i < 3; i++) {
tmp[i] = LLVMBuildExtractElement(gallivm->builder, bld->system_values.block_id, lp_build_const_int32(gallivm, i), "");
tmp[i] = bld->system_values.block_id[i];
if (instr->dest.ssa.bit_size == 64)
tmp[i] = LLVMBuildZExt(gallivm->builder, tmp[i], bld_base->uint64_bld.elem_type, "");
result[i] = lp_build_broadcast_scalar(bld_broad, tmp[i]);
+1 -1
View File
@@ -173,7 +173,7 @@ struct lp_bld_tgsi_system_values {
LLVMValueRef invocation_id;
LLVMValueRef draw_id;
LLVMValueRef thread_id[3];
LLVMValueRef block_id;
LLVMValueRef block_id[3];
LLVMValueRef grid_size;
LLVMValueRef front_facing;
LLVMValueRef work_dim;
@@ -1543,7 +1543,7 @@ emit_fetch_system_value(
break;
case TGSI_SEMANTIC_BLOCK_ID:
res = lp_build_extract_broadcast(gallivm, lp_type_int_vec(32, 96), bld_base->uint_bld.type, bld->system_values.block_id, lp_build_const_int32(gallivm, swizzle));
res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.block_id[swizzle]);
atype = TGSI_TYPE_UNSIGNED;
break;
+3 -4
View File
@@ -655,10 +655,9 @@ generate_compute(struct llvmpipe_context *lp,
system_values.thread_id[1] = lp_build_gather_values(gallivm, tids_y, cs_type.length);
system_values.thread_id[2] = lp_build_gather_values(gallivm, tids_z, cs_type.length);
LLVMValueRef gtids[3] = { grid_x_arg, grid_y_arg, grid_z_arg };
system_values.block_id = LLVMGetUndef(LLVMVectorType(int32_type, 3));
for (i = 0; i < 3; i++)
system_values.block_id = LLVMBuildInsertElement(builder, system_values.block_id, gtids[i], lp_build_const_int32(gallivm, i), "");
system_values.block_id[0] = grid_x_arg;
system_values.block_id[1] = grid_y_arg;
system_values.block_id[2] = grid_z_arg;
LLVMValueRef gstids[3] = { grid_size_x_arg, grid_size_y_arg, grid_size_z_arg };
system_values.grid_size = LLVMGetUndef(LLVMVectorType(int32_type, 3));