ac/llvm: rename attribute enums

Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20146>
This commit is contained in:
Marek Olšák 2022-12-04 06:19:56 -05:00 committed by Marge Bot
parent ce0a83efb8
commit ce860953a6
4 changed files with 15 additions and 16 deletions

View file

@ -309,14 +309,14 @@ LLVMValueRef ac_build_intrinsic(struct ac_llvm_context *ctx, const char *name,
call = LLVMBuildCall2(ctx->builder, function_type, function, params, param_count, "");
if (attrib_mask & AC_FUNC_ATTR_READNONE) {
if (attrib_mask & AC_ATTR_INVARIANT_LOAD) {
if (LLVM_VERSION_MAJOR >= 15)
LLVMSetMetadata(call, ctx->invariant_load_md_kind, ctx->empty_md);
else
LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "readnone"));
}
if (attrib_mask & AC_FUNC_ATTR_CONVERGENT)
if (attrib_mask & AC_ATTR_CONVERGENT)
LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "convergent"));
LLVMAddCallSiteAttribute(call, -1, ac_get_llvm_attribute(ctx->context, "nounwind"));
@ -1350,7 +1350,7 @@ LLVMValueRef ac_build_buffer_load(struct ac_llvm_context *ctx, LLVMValueRef rsrc
LLVMConstInt(ctx->i32, get_load_cache_policy(ctx, cache_policy), 0),
};
result[i] = ac_build_intrinsic(ctx, "llvm.amdgcn.s.buffer.load.f32", ctx->f32, args, 3,
AC_FUNC_ATTR_READNONE);
AC_ATTR_INVARIANT_LOAD);
}
if (num_channels == 1)
return result[0];
@ -3150,7 +3150,7 @@ void ac_apply_fmask_to_sample(struct ac_llvm_context *ac, LLVMValueRef fmask, LL
fmask_load.resource = fmask;
fmask_load.dmask = 0xf;
fmask_load.dim = is_array_tex ? ac_image_2darray : ac_image_2d;
fmask_load.attributes = AC_FUNC_ATTR_READNONE;
fmask_load.attributes = AC_ATTR_INVARIANT_LOAD;
fmask_load.coords[0] = addr[0];
fmask_load.coords[1] = addr[1];

View file

@ -40,11 +40,10 @@ extern "C" {
struct ac_compiler_passes;
struct ac_llvm_context;
enum ac_func_attr
{
/* Call attributes. */
AC_FUNC_ATTR_READNONE = (1 << 3),
AC_FUNC_ATTR_CONVERGENT = (1 << 4),
/* Attributes at call sites of intrinsics. */
enum ac_call_site_attr {
AC_ATTR_INVARIANT_LOAD = 1 << 0,
AC_ATTR_CONVERGENT = 1 << 1,
};
enum ac_target_machine_options
@ -99,7 +98,7 @@ void ac_llvm_set_target_features(LLVMValueRef F, struct ac_llvm_context *ctx);
static inline unsigned ac_get_load_intr_attribs(bool can_speculate)
{
return can_speculate ? AC_FUNC_ATTR_READNONE : 0;
return can_speculate ? AC_ATTR_INVARIANT_LOAD : 0;
}
LLVMTargetLibraryInfoRef ac_create_target_library_info(const char *triple);

View file

@ -1497,7 +1497,7 @@ static LLVMValueRef lower_gather4_integer(struct ac_llvm_context *ctx, struct ac
resinfo.dmask = 0xf;
resinfo.lod = ctx->i32_0;
resinfo.resource = args->resource;
resinfo.attributes = AC_FUNC_ATTR_READNONE;
resinfo.attributes = AC_ATTR_INVARIANT_LOAD;
LLVMValueRef size = ac_build_image_opcode(ctx, &resinfo);
/* Compute -0.5 / size. */
@ -1526,7 +1526,7 @@ static LLVMValueRef lower_gather4_integer(struct ac_llvm_context *ctx, struct ac
args->coords[c] = LLVMBuildFAdd(ctx->builder, tmp, half_texel[c], "");
}
args->attributes = AC_FUNC_ATTR_READNONE;
args->attributes = AC_ATTR_INVARIANT_LOAD;
result = ac_build_image_opcode(ctx, args);
if (instr->sampler_dim == GLSL_SAMPLER_DIM_CUBE) {
@ -1627,7 +1627,7 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, const nir_te
}
}
args->attributes = AC_FUNC_ATTR_READNONE;
args->attributes = AC_ATTR_INVARIANT_LOAD;
bool cs_derivs =
ctx->stage == MESA_SHADER_COMPUTE && ctx->info->cs.derivative_group != DERIVATIVE_GROUP_NONE;
if (ctx->stage == MESA_SHADER_FRAGMENT || cs_derivs) {
@ -1637,7 +1637,7 @@ static LLVMValueRef build_tex_intrinsic(struct ac_nir_context *ctx, const nir_te
case nir_texop_tex:
case nir_texop_txb:
case nir_texop_lod:
args->attributes |= AC_FUNC_ATTR_CONVERGENT;
args->attributes |= AC_ATTR_CONVERGENT;
break;
default:
break;
@ -2648,7 +2648,7 @@ static LLVMValueRef visit_image_load(struct ac_nir_context *ctx, const nir_intri
get_image_coords(ctx, instr, dynamic_index, &args, GLSL_SAMPLER_DIM_2D, is_array);
args.dmask = 0xf;
args.dim = is_array ? ac_image_2darray : ac_image_2d;
args.attributes = AC_FUNC_ATTR_READNONE;
args.attributes = AC_ATTR_INVARIANT_LOAD;
args.a16 = ac_get_elem_bits(&ctx->ac, LLVMTypeOf(args.coords[0])) == 16;
res = ac_build_image_opcode(&ctx->ac, &args);

View file

@ -99,7 +99,7 @@ static LLVMValueRef si_nir_emit_fbfetch(struct ac_shader_abi *abi)
args.opcode = ac_image_load;
args.resource = image;
args.dmask = 0xf;
args.attributes = AC_FUNC_ATTR_READNONE;
args.attributes = AC_ATTR_INVARIANT_LOAD;
if (ctx->shader->key.ps.mono.fbfetch_msaa)
args.dim =