ac/llvm: add a workaround for nir_intrinsic_load_constant for LLVM on gfx12

Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29007>
This commit is contained in:
Marek Olšák
2024-04-26 17:31:58 -04:00
parent 546465e1ba
commit 686e5a03f5
+11
View File
@@ -3439,6 +3439,17 @@ static bool visit_intrinsic(struct ac_nir_context *ctx, nir_intrinsic_instr *ins
offset = LLVMBuildSelect(ctx->ac.builder, cond, offset, size, "");
LLVMValueRef ptr = ac_build_gep0(&ctx->ac, ctx->constant_data, offset);
/* TODO: LLVM doesn't sign-extend the result of s_getpc_b64 correctly, causing hangs.
* Do it manually here.
*/
if (ctx->ac.gfx_level == GFX12) {
LLVMValueRef addr = LLVMBuildPtrToInt(ctx->ac.builder, ptr, ctx->ac.i64, "");
addr = LLVMBuildOr(ctx->ac.builder, addr,
LLVMConstInt(ctx->ac.i64, 0xffff000000000000ull, 0), "");
ptr = LLVMBuildIntToPtr(ctx->ac.builder, addr, LLVMTypeOf(ptr), "");
}
LLVMTypeRef comp_type = LLVMIntTypeInContext(ctx->ac.context, instr->def.bit_size);
LLVMTypeRef vec_type = instr->def.num_components == 1
? comp_type