gallivm: convert grid_size to discrete values.

No use in storing this 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:19:08 +10:00
parent e021973f5a
commit c0123d792c
4 changed files with 6 additions and 7 deletions
@@ -1941,7 +1941,7 @@ static void emit_sysval_intrin(struct lp_build_nir_context *bld_base,
case nir_intrinsic_load_num_workgroups: {
LLVMValueRef tmp[3];
for (unsigned i = 0; i < 3; i++) {
tmp[i] = LLVMBuildExtractElement(gallivm->builder, bld->system_values.grid_size, lp_build_const_int32(gallivm, i), "");
tmp[i] = bld->system_values.grid_size[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
@@ -174,7 +174,7 @@ struct lp_bld_tgsi_system_values {
LLVMValueRef draw_id;
LLVMValueRef thread_id[3];
LLVMValueRef block_id[3];
LLVMValueRef grid_size;
LLVMValueRef grid_size[3];
LLVMValueRef front_facing;
LLVMValueRef work_dim;
LLVMValueRef block_size;
@@ -1548,7 +1548,7 @@ emit_fetch_system_value(
break;
case TGSI_SEMANTIC_GRID_SIZE:
res = lp_build_extract_broadcast(gallivm, lp_type_int_vec(32, 96), bld_base->uint_bld.type, bld->system_values.grid_size, lp_build_const_int32(gallivm, swizzle));
res = lp_build_broadcast_scalar(&bld_base->uint_bld, bld->system_values.grid_size[swizzle]);
atype = TGSI_TYPE_UNSIGNED;
break;
+3 -4
View File
@@ -659,10 +659,9 @@ generate_compute(struct llvmpipe_context *lp,
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));
for (i = 0; i < 3; i++)
system_values.grid_size = LLVMBuildInsertElement(builder, system_values.grid_size, gstids[i], lp_build_const_int32(gallivm, i), "");
system_values.grid_size[0] = grid_size_x_arg;
system_values.grid_size[1] = grid_size_y_arg;
system_values.grid_size[2] = grid_size_z_arg;
system_values.work_dim = work_dim_arg;
system_values.draw_id = draw_id_arg;