mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-24 11:00:11 +01:00
pco: further commonize iteration instruction emission
Signed-off-by: Simon Perretta <simon.perretta@imgtec.com> Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36412>
This commit is contained in:
parent
bd274e27be
commit
cbf58fea6f
6 changed files with 67 additions and 53 deletions
|
|
@ -230,15 +230,12 @@ pco_loop *pco_loop_create(pco_func *func)
|
|||
* \brief Allocates and sets up a PCO instruction.
|
||||
*
|
||||
* \param[in,out] func Parent function.
|
||||
* \param[in] op Instruction op.
|
||||
* \param[in] num_dests Number of destinations.
|
||||
* \param[in] num_srcs Number of sources.
|
||||
* \return The PCO instruction, or NULL on failure.
|
||||
*/
|
||||
pco_instr *pco_instr_create(pco_func *func,
|
||||
enum pco_op op,
|
||||
unsigned num_dests,
|
||||
unsigned num_srcs)
|
||||
pco_instr *
|
||||
pco_instr_create(pco_func *func, unsigned num_dests, unsigned num_srcs)
|
||||
{
|
||||
pco_instr *instr;
|
||||
unsigned size = sizeof(*instr);
|
||||
|
|
@ -249,8 +246,6 @@ pco_instr *pco_instr_create(pco_func *func,
|
|||
|
||||
instr->parent_func = func;
|
||||
|
||||
instr->op = op;
|
||||
|
||||
instr->num_dests = num_dests;
|
||||
instr->dest = (pco_ref *)(instr + 1);
|
||||
|
||||
|
|
|
|||
|
|
@ -127,10 +127,11 @@ static
|
|||
pco_instr *_${op.bname}_(${op.builder_params[0]})
|
||||
{
|
||||
pco_instr *instr = pco_instr_create(func,
|
||||
${op.cname.upper()},
|
||||
${'num_dests' if op.num_dests == VARIABLE else op.num_dests},
|
||||
${'num_srcs' if op.num_srcs == VARIABLE else op.num_srcs});
|
||||
|
||||
instr->op = ${op.cname.upper()};
|
||||
|
||||
% if op.has_target_cf_node:
|
||||
instr->target_cf_node = target_cf_node;
|
||||
% endif
|
||||
|
|
|
|||
|
|
@ -430,10 +430,8 @@ pco_func *pco_func_create(pco_shader *shader,
|
|||
pco_block *pco_block_create(pco_func *func);
|
||||
pco_if *pco_if_create(pco_func *func);
|
||||
pco_loop *pco_loop_create(pco_func *func);
|
||||
pco_instr *pco_instr_create(pco_func *func,
|
||||
enum pco_op op,
|
||||
unsigned num_dests,
|
||||
unsigned num_srcs);
|
||||
pco_instr *
|
||||
pco_instr_create(pco_func *func, unsigned num_dests, unsigned num_srcs);
|
||||
pco_igrp *pco_igrp_create(pco_func *func);
|
||||
|
||||
void pco_instr_delete(pco_instr *instr);
|
||||
|
|
|
|||
|
|
@ -2776,13 +2776,13 @@ group_map(O_UVSW_WRITE_EMIT_ENDTASK,
|
|||
group_map(O_FITR,
|
||||
hdr=(I_IGRP_HDR_MAIN, [
|
||||
('oporg', 'be'),
|
||||
('olchk', OM_OLCHK),
|
||||
('olchk', False),
|
||||
('w1p', False),
|
||||
('w0p', False),
|
||||
('cc', OM_EXEC_CND),
|
||||
('end', OM_END),
|
||||
('atom', OM_ATOM),
|
||||
('rpt', OM_RPT)
|
||||
('atom', False),
|
||||
('rpt', 1)
|
||||
]),
|
||||
enc_ops=[('backend', O_FITR)],
|
||||
srcs=[
|
||||
|
|
@ -2794,13 +2794,13 @@ group_map(O_FITR,
|
|||
group_map(O_FITRP,
|
||||
hdr=(I_IGRP_HDR_MAIN, [
|
||||
('oporg', 'be'),
|
||||
('olchk', OM_OLCHK),
|
||||
('olchk', False),
|
||||
('w1p', False),
|
||||
('w0p', False),
|
||||
('cc', OM_EXEC_CND),
|
||||
('end', OM_END),
|
||||
('atom', OM_ATOM),
|
||||
('rpt', OM_RPT)
|
||||
('atom', False),
|
||||
('rpt', 1)
|
||||
]),
|
||||
enc_ops=[('backend', O_FITRP)],
|
||||
srcs=[
|
||||
|
|
|
|||
|
|
@ -376,8 +376,8 @@ O_UVSW_ENDTASK = hw_op('uvsw.endtask', [OM_END])
|
|||
O_UVSW_EMIT_ENDTASK = hw_op('uvsw.emit.endtask', [OM_END])
|
||||
O_UVSW_WRITE_EMIT_ENDTASK = hw_op('uvsw.write.emit.endtask', [OM_END], 0, 2)
|
||||
|
||||
O_FITR = hw_op('fitr', OM_ALU + [OM_ITR_MODE, OM_SAT], 1, 3)
|
||||
O_FITRP = hw_op('fitrp', OM_ALU + [OM_ITR_MODE, OM_SAT], 1, 4)
|
||||
O_FITR = hw_op('fitr', [OM_EXEC_CND, OM_END, OM_ITR_MODE, OM_SAT], 1, 3)
|
||||
O_FITRP = hw_op('fitrp', [OM_EXEC_CND, OM_END, OM_ITR_MODE, OM_SAT], 1, 4)
|
||||
|
||||
O_LD = hw_op('ld', OM_ALU_RPT1 + [OM_MCU_CACHE_MODE_LD], 1, 3)
|
||||
O_ST = hw_direct_op('st', [OM_MCU_CACHE_MODE_ST], 0, 6)
|
||||
|
|
|
|||
|
|
@ -250,6 +250,43 @@ trans_store_output_vs(trans_ctx *tctx, nir_intrinsic_instr *intr, pco_ref src)
|
|||
return pco_uvsw_write(&tctx->b, src, vtxout_addr, .rpt = chans);
|
||||
}
|
||||
|
||||
static inline pco_instr *build_itr(pco_builder *b,
|
||||
pco_ref dest,
|
||||
enum pco_drc drc,
|
||||
pco_ref coeffs,
|
||||
pco_ref wcoeffs,
|
||||
unsigned _itr_count,
|
||||
enum pco_itr_mode itr_mode,
|
||||
bool d)
|
||||
{
|
||||
pco_func *func = pco_cursor_func(b->cursor);
|
||||
pco_ref itr_count = pco_ref_val16(_itr_count);
|
||||
bool p = !pco_ref_is_null(wcoeffs);
|
||||
pco_instr *instr = pco_instr_create(func, 1, 3 + p);
|
||||
|
||||
instr->op = d ? (p ? PCO_OP_DITRP : PCO_OP_DITR)
|
||||
: (p ? PCO_OP_FITRP : PCO_OP_FITR);
|
||||
|
||||
instr->dest[0] = dest;
|
||||
instr->src[0] = pco_ref_drc(drc);
|
||||
instr->src[1] = coeffs;
|
||||
instr->src[2] = p ? wcoeffs : itr_count;
|
||||
if (p)
|
||||
instr->src[3] = itr_count;
|
||||
|
||||
pco_instr_set_itr_mode(instr, itr_mode);
|
||||
|
||||
if (d)
|
||||
pco_fence(b);
|
||||
|
||||
pco_builder_insert_instr(b, instr);
|
||||
|
||||
if (d)
|
||||
pco_fence(b);
|
||||
|
||||
return instr;
|
||||
}
|
||||
|
||||
/**
|
||||
* \brief Translates a NIR fs load_input intrinsic into PCO.
|
||||
*
|
||||
|
|
@ -332,7 +369,6 @@ trans_load_input_fs(trans_ctx *tctx, nir_intrinsic_instr *intr, pco_ref dest)
|
|||
pco_ref coeffs = pco_ref_hwreg_vec(coeffs_index,
|
||||
PCO_REG_CLASS_COEFF,
|
||||
ROGUE_USC_COEFFICIENT_SET_SIZE * chans);
|
||||
pco_ref itr_count = pco_ref_val16(chans);
|
||||
|
||||
bool usc_itrsmp_enhanced =
|
||||
PVR_HAS_FEATURE(tctx->pco_ctx->dev_info, usc_itrsmp_enhanced);
|
||||
|
|
@ -348,23 +384,14 @@ trans_load_input_fs(trans_ctx *tctx, nir_intrinsic_instr *intr, pco_ref dest)
|
|||
PCO_REG_CLASS_COEFF,
|
||||
ROGUE_USC_COEFFICIENT_SET_SIZE);
|
||||
|
||||
if (usc_itrsmp_enhanced)
|
||||
pco_fence(&tctx->b);
|
||||
|
||||
return usc_itrsmp_enhanced ? pco_ditrp(&tctx->b,
|
||||
dest,
|
||||
pco_ref_drc(PCO_DRC_0),
|
||||
coeffs,
|
||||
wcoeffs,
|
||||
itr_count,
|
||||
.itr_mode = itr_mode)
|
||||
: pco_fitrp(&tctx->b,
|
||||
dest,
|
||||
pco_ref_drc(PCO_DRC_0),
|
||||
coeffs,
|
||||
wcoeffs,
|
||||
itr_count,
|
||||
.itr_mode = itr_mode);
|
||||
return build_itr(&tctx->b,
|
||||
dest,
|
||||
PCO_DRC_0,
|
||||
coeffs,
|
||||
wcoeffs,
|
||||
chans,
|
||||
itr_mode,
|
||||
usc_itrsmp_enhanced);
|
||||
}
|
||||
|
||||
case INTERP_MODE_FLAT: {
|
||||
|
|
@ -377,21 +404,14 @@ trans_load_input_fs(trans_ctx *tctx, nir_intrinsic_instr *intr, pco_ref dest)
|
|||
}
|
||||
|
||||
case INTERP_MODE_NOPERSPECTIVE:
|
||||
if (usc_itrsmp_enhanced)
|
||||
pco_fence(&tctx->b);
|
||||
|
||||
return usc_itrsmp_enhanced ? pco_ditr(&tctx->b,
|
||||
dest,
|
||||
pco_ref_drc(PCO_DRC_0),
|
||||
coeffs,
|
||||
itr_count,
|
||||
.itr_mode = itr_mode)
|
||||
: pco_fitr(&tctx->b,
|
||||
dest,
|
||||
pco_ref_drc(PCO_DRC_0),
|
||||
coeffs,
|
||||
itr_count,
|
||||
.itr_mode = itr_mode);
|
||||
return build_itr(&tctx->b,
|
||||
dest,
|
||||
PCO_DRC_0,
|
||||
coeffs,
|
||||
pco_ref_null(),
|
||||
chans,
|
||||
itr_mode,
|
||||
usc_itrsmp_enhanced);
|
||||
|
||||
default:
|
||||
/* Should have been previously lowered. */
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue