aco: Add and use nir_abi_to_aco helper

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39314>
This commit is contained in:
Natalie Vock 2026-01-13 17:17:31 +01:00 committed by Marge Bot
parent 30f6eacfad
commit 2d6ecf303a
3 changed files with 18 additions and 18 deletions

View file

@ -288,6 +288,8 @@ void build_end_with_regs(isel_context* ctx, std::vector<Operand>& regs);
Instruction* add_startpgm(struct isel_context* ctx, bool is_callee = false);
void finish_program(isel_context* ctx);
ABI nir_abi_to_aco(unsigned nir_abi_mask);
struct callee_info get_callee_info(amd_gfx_level gfx_level, unsigned wave_size, const ABI& abi,
unsigned param_count, const nir_parameter* parameters,
Program* program, RegisterDemand reg_limit);

View file

@ -823,6 +823,17 @@ finish_program(isel_context* ctx)
}
}
ABI
nir_abi_to_aco(unsigned function_attributes)
{
switch (function_attributes & ACO_NIR_FUNCTION_ATTRIB_ABI_MASK) {
case ACO_NIR_CALL_ABI_RT_RECURSIVE: return rtRaygenABI;
case ACO_NIR_CALL_ABI_TRAVERSAL: return rtTraversalABI;
case ACO_NIR_CALL_ABI_AHIT_ISEC: return rtAnyHitABI;
default: UNREACHABLE("invalid abi");
}
}
struct param_assignment_info {
uint16_t required_alignment;
uint16_t provided_alignment;

View file

@ -794,14 +794,8 @@ visit_call(isel_context* ctx, nir_call_instr* instr)
{
Builder bld(ctx->program, ctx->block);
ABI abi;
/* TODO: callable abi? */
switch (instr->callee->driver_attributes & ACO_NIR_FUNCTION_ATTRIB_ABI_MASK) {
case ACO_NIR_CALL_ABI_RT_RECURSIVE: abi = rtRaygenABI; break;
case ACO_NIR_CALL_ABI_TRAVERSAL: abi = rtTraversalABI; break;
case ACO_NIR_CALL_ABI_AHIT_ISEC: abi = rtAnyHitABI; break;
default: UNREACHABLE("invalid abi");
}
unsigned nir_abi = instr->callee->driver_attributes & ACO_NIR_FUNCTION_ATTRIB_ABI_MASK;
ABI abi = nir_abi_to_aco(instr->callee->driver_attributes);
RegisterDemand limit = get_addr_regs_from_waves(ctx->program, ctx->program->min_waves);
@ -1357,18 +1351,11 @@ select_program_rt(isel_context& ctx, unsigned shader_count, struct nir_shader* c
break;
}
ABI abi;
/* TODO: callable abi? */
switch (impl->function->driver_attributes & ACO_NIR_FUNCTION_ATTRIB_ABI_MASK) {
case ACO_NIR_CALL_ABI_RT_RECURSIVE: abi = rtRaygenABI; break;
case ACO_NIR_CALL_ABI_TRAVERSAL: abi = rtTraversalABI; break;
case ACO_NIR_CALL_ABI_AHIT_ISEC: abi = rtAnyHitABI; break;
default: UNREACHABLE("invalid abi");
}
unsigned nir_abi = (impl->function->driver_attributes & ACO_NIR_FUNCTION_ATTRIB_ABI_MASK);
RegisterDemand limit = get_addr_regs_from_waves(ctx.program, ctx.program->min_waves);
ctx.callee_abi = abi;
/* TODO: callable abi? */
ctx.callee_abi = nir_abi_to_aco(impl->function->driver_attributes);
ctx.program->callee_abi = ctx.callee_abi;
ctx.callee_info =
get_callee_info(ctx.program->gfx_level, ctx.program->wave_size, ctx.callee_abi,