ac/nir: implement nir_intrinsic_shader_clock with device scope
Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5117>
This commit is contained in:
@@ -457,9 +457,10 @@ ac_build_optimization_barrier(struct ac_llvm_context *ctx,
|
|||||||
}
|
}
|
||||||
|
|
||||||
LLVMValueRef
|
LLVMValueRef
|
||||||
ac_build_shader_clock(struct ac_llvm_context *ctx)
|
ac_build_shader_clock(struct ac_llvm_context *ctx, nir_scope scope)
|
||||||
{
|
{
|
||||||
LLVMValueRef tmp = ac_build_intrinsic(ctx, "llvm.amdgcn.s.memtime", ctx->i64, NULL, 0, 0);
|
const char *name = scope == NIR_SCOPE_DEVICE ? "llvm.amdgcn.s.memrealtime" : "llvm.amdgcn.s.memtime";
|
||||||
|
LLVMValueRef tmp = ac_build_intrinsic(ctx, name, ctx->i64, NULL, 0, 0);
|
||||||
return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
|
return LLVMBuildBitCast(ctx->builder, tmp, ctx->v2i32, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -181,7 +181,8 @@ void ac_build_s_barrier(struct ac_llvm_context *ctx);
|
|||||||
void ac_build_optimization_barrier(struct ac_llvm_context *ctx,
|
void ac_build_optimization_barrier(struct ac_llvm_context *ctx,
|
||||||
LLVMValueRef *pvgpr);
|
LLVMValueRef *pvgpr);
|
||||||
|
|
||||||
LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx);
|
LLVMValueRef ac_build_shader_clock(struct ac_llvm_context *ctx,
|
||||||
|
nir_scope scope);
|
||||||
|
|
||||||
LLVMValueRef ac_build_ballot(struct ac_llvm_context *ctx, LLVMValueRef value);
|
LLVMValueRef ac_build_ballot(struct ac_llvm_context *ctx, LLVMValueRef value);
|
||||||
LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
|
LLVMValueRef ac_get_i1_sgpr_mask(struct ac_llvm_context *ctx,
|
||||||
|
@@ -3864,7 +3864,8 @@ static void visit_intrinsic(struct ac_nir_context *ctx,
|
|||||||
result = visit_image_size(ctx, instr, false);
|
result = visit_image_size(ctx, instr, false);
|
||||||
break;
|
break;
|
||||||
case nir_intrinsic_shader_clock:
|
case nir_intrinsic_shader_clock:
|
||||||
result = ac_build_shader_clock(&ctx->ac);
|
result = ac_build_shader_clock(&ctx->ac,
|
||||||
|
nir_intrinsic_memory_scope(instr));
|
||||||
break;
|
break;
|
||||||
case nir_intrinsic_discard:
|
case nir_intrinsic_discard:
|
||||||
case nir_intrinsic_discard_if:
|
case nir_intrinsic_discard_if:
|
||||||
|
Reference in New Issue
Block a user