ac/llvm: add type param to ac_build_load_invariant

And adapt the only user of this function.

Reviewed-by: Mihai Preda <mhpreda@gmail.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Reviewed-by: Qiang Yu <yuq825@gmail.com>
Reviewed-by: Marek Olšák <marek.olsak@amd.com>
Acked-by: Samuel Pitoiset <samuel.pitoiset@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/19035>
This commit is contained in:
Pierre-Eric Pelloux-Prayer
2022-10-10 11:44:27 +02:00
committed by Marge Bot
parent f044de2e60
commit 18e78db39c
3 changed files with 3 additions and 5 deletions

View File

@@ -1164,7 +1164,7 @@ LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, L
return ac_build_load_custom(ctx, base_ptr, index, false, false, false);
}
LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index)
{
return ac_build_load_custom(ctx, base_ptr, index, false, true, false);

View File

@@ -262,7 +262,7 @@ void ac_build_indexed_store(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef value);
LLVMValueRef ac_build_load(struct ac_llvm_context *ctx, LLVMValueRef base_ptr, LLVMValueRef index);
LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef ac_build_load_invariant(struct ac_llvm_context *ctx, LLVMTypeRef type, LLVMValueRef base_ptr,
LLVMValueRef index);
LLVMValueRef ac_build_load_to_sgpr(struct ac_llvm_context *ctx, LLVMValueRef base_ptr,
LLVMValueRef index);

View File

@@ -3725,10 +3725,8 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
if (ctx->abi->load_grid_size_from_user_sgpr) {
result = ac_get_arg(&ctx->ac, ctx->args->num_work_groups);
} else {
LLVMTypeRef ptr_type = ac_array_in_const_addr_space(ctx->ac.v3i32);
LLVMValueRef ptr = ac_get_arg(&ctx->ac, ctx->args->num_work_groups);
ptr = LLVMBuildBitCast(ctx->ac.builder, ptr, ptr_type, "");
result = ac_build_load_invariant(&ctx->ac, ptr, ctx->ac.i32_0);
result = ac_build_load_invariant(&ctx->ac, ctx->ac.v3i32, ptr, ctx->ac.i32_0);
}
if (nir_dest_bit_size(instr->dest) == 64)
result = LLVMBuildZExt(ctx->ac.builder, result, LLVMVectorType(ctx->ac.i64, 3), "");