ac/llvm: remove inst_offset parameter from ac_build_buffer_load
Reviewed-by: Mihai Preda <mhpreda@gmail.com> Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/15966>
This commit is contained in:
@@ -1233,19 +1233,16 @@ static LLVMValueRef ac_build_buffer_load_common(struct ac_llvm_context *ctx, LLV
|
||||
|
||||
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
||||
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
|
||||
unsigned inst_offset, LLVMTypeRef channel_type,
|
||||
unsigned cache_policy, bool can_speculate, bool allow_smem)
|
||||
LLVMTypeRef channel_type, unsigned cache_policy,
|
||||
bool can_speculate, bool allow_smem)
|
||||
{
|
||||
LLVMValueRef offset = LLVMConstInt(ctx->i32, inst_offset, 0);
|
||||
if (voffset)
|
||||
offset = LLVMBuildAdd(ctx->builder, offset, voffset, "");
|
||||
|
||||
if (allow_smem && !(cache_policy & ac_slc) &&
|
||||
(!(cache_policy & ac_glc) || ctx->chip_class >= GFX8)) {
|
||||
assert(vindex == NULL);
|
||||
|
||||
LLVMValueRef result[8];
|
||||
|
||||
LLVMValueRef offset = voffset ? voffset : ctx->i32_0;
|
||||
if (soffset)
|
||||
offset = LLVMBuildAdd(ctx->builder, offset, soffset, "");
|
||||
|
||||
@@ -1269,7 +1266,7 @@ LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc
|
||||
return ac_build_gather_values(ctx, result, num_channels);
|
||||
}
|
||||
|
||||
return ac_build_buffer_load_common(ctx, rsrc, vindex, offset, soffset, num_channels,
|
||||
return ac_build_buffer_load_common(ctx, rsrc, vindex, voffset, soffset, num_channels,
|
||||
channel_type, cache_policy, can_speculate, false, false);
|
||||
}
|
||||
|
||||
|
@@ -263,8 +263,8 @@ void ac_build_buffer_store_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc
|
||||
|
||||
LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc, int num_channels,
|
||||
LLVMValueRef vindex, LLVMValueRef voffset, LLVMValueRef soffset,
|
||||
unsigned inst_offset, LLVMTypeRef channel_type,
|
||||
unsigned cache_policy, bool can_speculate, bool allow_smem);
|
||||
LLVMTypeRef channel_type, unsigned cache_policy,
|
||||
bool can_speculate, bool allow_smem);
|
||||
|
||||
LLVMValueRef ac_build_buffer_load_format(struct ac_llvm_context *ctx, LLVMValueRef rsrc,
|
||||
LLVMValueRef vindex, LLVMValueRef voffset,
|
||||
|
@@ -2093,7 +2093,7 @@ static LLVMValueRef visit_load_buffer(struct ac_nir_context *ctx, nir_intrinsic_
|
||||
int num_channels = util_next_power_of_two(load_bytes) / 4;
|
||||
bool can_speculate = access & ACCESS_CAN_REORDER;
|
||||
|
||||
ret = ac_build_buffer_load(&ctx->ac, rsrc, num_channels, vindex, offset, immoffset, 0,
|
||||
ret = ac_build_buffer_load(&ctx->ac, rsrc, num_channels, vindex, offset, immoffset,
|
||||
ctx->ac.f32, cache_policy, can_speculate, false);
|
||||
}
|
||||
|
||||
@@ -2310,7 +2310,7 @@ static LLVMValueRef visit_load_ubo_buffer(struct ac_nir_context *ctx, nir_intrin
|
||||
num_components = DIV_ROUND_UP(num_components, 4);
|
||||
|
||||
ret =
|
||||
ac_build_buffer_load(&ctx->ac, rsrc, num_components, NULL, offset, NULL, 0,
|
||||
ac_build_buffer_load(&ctx->ac, rsrc, num_components, NULL, offset, NULL,
|
||||
ctx->ac.f32, 0, true, true);
|
||||
|
||||
/* Convert to the original type. */
|
||||
@@ -4267,9 +4267,10 @@ static void visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
|
||||
else
|
||||
unreachable("Unsupported channel type for load_buffer_amd");
|
||||
|
||||
result = ac_build_buffer_load(&ctx->ac, descriptor, num_components, NULL,
|
||||
addr_voffset, addr_soffset, const_offset,
|
||||
channel_type, cache_policy, reorder, false);
|
||||
LLVMValueRef voffset = LLVMBuildAdd(ctx->ac.builder, addr_voffset,
|
||||
LLVMConstInt(ctx->ac.i32, const_offset, 0), "");
|
||||
result = ac_build_buffer_load(&ctx->ac, descriptor, num_components, NULL, voffset,
|
||||
addr_soffset, channel_type, cache_policy, reorder, false);
|
||||
result = ac_to_integer(&ctx->ac, ac_trim_vector(&ctx->ac, result, num_components));
|
||||
break;
|
||||
}
|
||||
@@ -4426,7 +4427,7 @@ static LLVMValueRef get_bindless_index_from_uniform(struct ac_nir_context *ctx,
|
||||
LLVMValueRef ubo_index = ctx->abi->load_ubo(ctx->abi, ctx->ac.i32_0);
|
||||
|
||||
LLVMValueRef ret =
|
||||
ac_build_buffer_load(&ctx->ac, ubo_index, 1, NULL, offset, NULL, 0, ctx->ac.f32, 0, true, true);
|
||||
ac_build_buffer_load(&ctx->ac, ubo_index, 1, NULL, offset, NULL, ctx->ac.f32, 0, true, true);
|
||||
|
||||
return LLVMBuildBitCast(ctx->ac.builder, ret, ctx->ac.i32, "");
|
||||
}
|
||||
|
@@ -2396,7 +2396,7 @@ ac_gs_copy_shader_emit(struct radv_shader_context *ctx)
|
||||
offset++;
|
||||
|
||||
value = ac_build_buffer_load(&ctx->ac, ctx->gsvs_ring[0], 1, ctx->ac.i32_0, vtx_offset,
|
||||
soffset, 0, ctx->ac.f32, ac_glc | ac_slc, true, false);
|
||||
soffset, ctx->ac.f32, ac_glc | ac_slc, true, false);
|
||||
|
||||
LLVMTypeRef type = LLVMGetAllocatedType(ctx->abi.outputs[ac_llvm_reg_index_soa(i, j)]);
|
||||
if (ac_get_type_size(type) == 2) {
|
||||
|
@@ -272,7 +272,7 @@ void si_llvm_dispose(struct si_shader_context *ctx)
|
||||
LLVMValueRef si_buffer_load_const(struct si_shader_context *ctx, LLVMValueRef resource,
|
||||
LLVMValueRef offset)
|
||||
{
|
||||
return ac_build_buffer_load(&ctx->ac, resource, 1, NULL, offset, NULL, 0, ctx->ac.f32,
|
||||
return ac_build_buffer_load(&ctx->ac, resource, 1, NULL, offset, NULL, ctx->ac.f32,
|
||||
0, true, true);
|
||||
}
|
||||
|
||||
|
@@ -74,7 +74,7 @@ static LLVMValueRef si_llvm_load_input_gs(struct ac_shader_abi *abi, unsigned in
|
||||
|
||||
soffset = LLVMConstInt(ctx->ac.i32, (param * 4 + swizzle) * 256, 0);
|
||||
|
||||
value = ac_build_buffer_load(&ctx->ac, ctx->esgs_ring, 1, ctx->ac.i32_0, vtx_offset, soffset, 0,
|
||||
value = ac_build_buffer_load(&ctx->ac, ctx->esgs_ring, 1, ctx->ac.i32_0, vtx_offset, soffset,
|
||||
ctx->ac.f32, ac_glc, true, false);
|
||||
return LLVMBuildBitCast(ctx->ac.builder, value, type, "");
|
||||
}
|
||||
@@ -531,7 +531,7 @@ struct si_shader *si_generate_gs_copy_shader(struct si_screen *sscreen,
|
||||
offset++;
|
||||
|
||||
outputs[i].values[chan] =
|
||||
ac_build_buffer_load(&ctx.ac, ctx.gsvs_ring[0], 1, ctx.ac.i32_0, voffset, soffset, 0,
|
||||
ac_build_buffer_load(&ctx.ac, ctx.gsvs_ring[0], 1, ctx.ac.i32_0, voffset, soffset,
|
||||
ctx.ac.f32, ac_glc | ac_slc, true, false);
|
||||
}
|
||||
}
|
||||
|
@@ -275,13 +275,13 @@ static LLVMValueRef buffer_load(struct si_shader_context *ctx, LLVMTypeRef type,
|
||||
LLVMTypeRef vec_type = LLVMVectorType(type, 4);
|
||||
|
||||
if (swizzle == ~0) {
|
||||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, type, ac_glc,
|
||||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, type, ac_glc,
|
||||
can_speculate, false);
|
||||
|
||||
return LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");
|
||||
}
|
||||
|
||||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, 0, type, ac_glc,
|
||||
value = ac_build_buffer_load(&ctx->ac, buffer, 4, NULL, base, offset, type, ac_glc,
|
||||
can_speculate, false);
|
||||
|
||||
value = LLVMBuildBitCast(ctx->ac.builder, value, vec_type, "");
|
||||
|
Reference in New Issue
Block a user