mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-30 14:20:11 +01:00
aco: implement subgroup shader_clock on GFX10.3
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com> Reviewed-by: Daniel Schürmann <daniel@schuermann.dev> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5546>
This commit is contained in:
parent
a5303a3cbe
commit
07250a92da
3 changed files with 16 additions and 6 deletions
|
|
@ -8155,11 +8155,18 @@ void visit_intrinsic(isel_context *ctx, nir_intrinsic_instr *instr)
|
|||
break;
|
||||
}
|
||||
case nir_intrinsic_shader_clock: {
|
||||
aco_opcode opcode =
|
||||
nir_intrinsic_memory_scope(instr) == NIR_SCOPE_DEVICE ?
|
||||
aco_opcode::s_memrealtime : aco_opcode::s_memtime;
|
||||
bld.smem(opcode, Definition(get_ssa_temp(ctx, &instr->dest.ssa)), memory_sync_info(0, semantic_volatile));
|
||||
emit_split_vector(ctx, get_ssa_temp(ctx, &instr->dest.ssa), 2);
|
||||
Temp dst = get_ssa_temp(ctx, &instr->dest.ssa);
|
||||
if (nir_intrinsic_memory_scope(instr) == NIR_SCOPE_SUBGROUP && ctx->options->chip_class >= GFX10_3) {
|
||||
/* "((size - 1) << 11) | register" (SHADER_CYCLES is encoded as register 29) */
|
||||
Temp clock = bld.sopk(aco_opcode::s_getreg_b32, bld.def(s1), ((20 - 1) << 11) | 29);
|
||||
bld.pseudo(aco_opcode::p_create_vector, Definition(dst), clock, Operand(0u));
|
||||
} else {
|
||||
aco_opcode opcode =
|
||||
nir_intrinsic_memory_scope(instr) == NIR_SCOPE_DEVICE ?
|
||||
aco_opcode::s_memrealtime : aco_opcode::s_memtime;
|
||||
bld.smem(opcode, Definition(dst), memory_sync_info(0, semantic_volatile));
|
||||
}
|
||||
emit_split_vector(ctx, dst, 2);
|
||||
break;
|
||||
}
|
||||
case nir_intrinsic_load_vertex_id_zero_base: {
|
||||
|
|
|
|||
|
|
@ -219,6 +219,8 @@ struct InstrPred {
|
|||
|
||||
switch (a->format) {
|
||||
case Format::SOPK: {
|
||||
if (a->opcode == aco_opcode::s_getreg_b32)
|
||||
return false;
|
||||
SOPK_instruction* aK = static_cast<SOPK_instruction*>(a);
|
||||
SOPK_instruction* bK = static_cast<SOPK_instruction*>(b);
|
||||
return aK->imm == bK->imm;
|
||||
|
|
|
|||
|
|
@ -459,7 +459,8 @@ HazardResult perform_hazard_query(hazard_query *query, Instruction *instr, bool
|
|||
/* don't move non-reorderable instructions */
|
||||
if (instr->opcode == aco_opcode::s_memtime ||
|
||||
instr->opcode == aco_opcode::s_memrealtime ||
|
||||
instr->opcode == aco_opcode::s_setprio)
|
||||
instr->opcode == aco_opcode::s_setprio ||
|
||||
instr->opcode == aco_opcode::s_getreg_b32)
|
||||
return hazard_fail_unreorderable;
|
||||
|
||||
memory_event_set instr_set;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue