From 8ef839374e234ecc4c2b31d07bba472eb39246f6 Mon Sep 17 00:00:00 2001 From: Simon Perretta Date: Sun, 12 Feb 2023 14:22:27 +0000 Subject: [PATCH] pvr: Add support for sample instructions Signed-off-by: Simon Perretta Acked-by: Frank Binns Part-of: --- .../passes/rogue_schedule_instr_groups.c | 35 +++++ src/imagination/rogue/rogue.h | 52 +++++++ .../rogue/rogue_backend_instrs.def | 9 ++ src/imagination/rogue/rogue_builder.c | 40 +++++ src/imagination/rogue/rogue_builder.h | 10 ++ src/imagination/rogue/rogue_encode.c | 137 ++++++++++++++++++ src/imagination/rogue/rogue_info.c | 92 +++++++++++- src/imagination/rogue/rogue_isa.h | 89 +++++++++++- 8 files changed, 459 insertions(+), 5 deletions(-) diff --git a/src/imagination/rogue/passes/rogue_schedule_instr_groups.c b/src/imagination/rogue/passes/rogue_schedule_instr_groups.c index 1a03e5a8ada..8a63a2e681d 100644 --- a/src/imagination/rogue/passes/rogue_schedule_instr_groups.c +++ b/src/imagination/rogue/passes/rogue_schedule_instr_groups.c @@ -561,6 +561,7 @@ static void rogue_calc_alu_instrs_size(rogue_instr_group *group, #undef DM #undef SM +#define OM(op_mod) ROGUE_BACKEND_OP_MOD_##op_mod static void rogue_calc_backend_instrs_size(rogue_instr_group *group, rogue_backend_instr *backend, enum rogue_instr_phase phase) @@ -590,10 +591,44 @@ static void rogue_calc_backend_instrs_size(rogue_instr_group *group, group->size.instrs[phase] = 3; break; + case ROGUE_BACKEND_OP_SMP1D: + case ROGUE_BACKEND_OP_SMP2D: + case ROGUE_BACKEND_OP_SMP3D: + group->size.instrs[phase] = 2; + + if (rogue_backend_op_mod_is_set(backend, OM(ARRAY))) { + group->size.instrs[phase] = 5; + } else if (rogue_backend_op_mod_is_set(backend, OM(WRT)) || + rogue_backend_op_mod_is_set(backend, OM(BYPASS)) || + rogue_backend_op_mod_is_set(backend, OM(FORCELINEFILL)) || + rogue_backend_op_mod_is_set(backend, OM(WRITETHROUGH)) || + rogue_backend_op_mod_is_set(backend, OM(WRITEBACK)) || + rogue_backend_op_mod_is_set(backend, OM(LAZYWRITEBACK)) || + rogue_backend_op_mod_is_set(backend, OM(SCHEDSWAP)) || + rogue_backend_op_mod_is_set(backend, OM(F16)) || + rogue_backend_op_mod_is_set(backend, OM(SLCBYPASS)) || + rogue_backend_op_mod_is_set(backend, OM(SLCWRITEBACK)) || + rogue_backend_op_mod_is_set(backend, OM(SLCWRITETHROUGH)) || + rogue_backend_op_mod_is_set(backend, OM(SLCNOALLOC))) { + group->size.instrs[phase] = 4; + } else if (rogue_backend_op_mod_is_set(backend, OM(TAO)) || + rogue_backend_op_mod_is_set(backend, OM(SOO)) || + rogue_backend_op_mod_is_set(backend, OM(SNO)) || + rogue_backend_op_mod_is_set(backend, OM(NNCOORDS)) || + rogue_backend_op_mod_is_set(backend, OM(DATA)) || + rogue_backend_op_mod_is_set(backend, OM(INFO)) || + rogue_backend_op_mod_is_set(backend, OM(BOTH)) || + rogue_backend_op_mod_is_set(backend, OM(PROJ)) || + rogue_backend_op_mod_is_set(backend, OM(PPLOD))) { + group->size.instrs[phase] = 3; + } + break; + default: unreachable("Unsupported backend op."); } } +#undef OM static void rogue_calc_ctrl_instrs_size(rogue_instr_group *group, rogue_ctrl_instr *ctrl, diff --git a/src/imagination/rogue/rogue.h b/src/imagination/rogue/rogue.h index 07d2c979feb..4ff55bfbcc8 100644 --- a/src/imagination/rogue/rogue.h +++ b/src/imagination/rogue/rogue.h @@ -1343,6 +1343,10 @@ enum rogue_backend_op { /* ROGUE_BACKEND_OP_FITRP_SAMPLE, */ /* ROGUE_BACKEND_OP_FITRP_CENTROID, */ + ROGUE_BACKEND_OP_SMP1D, + ROGUE_BACKEND_OP_SMP2D, + ROGUE_BACKEND_OP_SMP3D, + ROGUE_BACKEND_OP_PSEUDO, ROGUE_BACKEND_OP_COUNT = ROGUE_BACKEND_OP_PSEUDO, }; @@ -1379,8 +1383,56 @@ typedef struct rogue_backend_op_info { extern const rogue_backend_op_info rogue_backend_op_infos[ROGUE_BACKEND_OP_COUNT]; +/* TODO: Some of these may not be used together; express that in op mod info. */ enum rogue_backend_op_mod { /* In order of priority */ + ROGUE_BACKEND_OP_MOD_PROJ, /* Projection (send T co-ordinate). */ + ROGUE_BACKEND_OP_MOD_FCNORM, /* Fixed-point texture data (convert to float). + */ + ROGUE_BACKEND_OP_MOD_NNCOORDS, /* Non-normalised co-ordinates. */ + + ROGUE_BACKEND_OP_MOD_BIAS, /* LOD mode: bias. */ + ROGUE_BACKEND_OP_MOD_REPLACE, /* LOD mode: replace. */ + ROGUE_BACKEND_OP_MOD_GRADIENT, /* LOD mode: gradient. */ + + ROGUE_BACKEND_OP_MOD_PPLOD, /* Per-pixel LOD. */ + ROGUE_BACKEND_OP_MOD_TAO, /* Texture address override. */ + ROGUE_BACKEND_OP_MOD_SOO, /* Sample offset supplied. */ + ROGUE_BACKEND_OP_MOD_SNO, /* Sample number supplied. */ + ROGUE_BACKEND_OP_MOD_WRT, /* SMP write. */ + + ROGUE_BACKEND_OP_MOD_DATA, /* Sample bypass mode: data. */ + ROGUE_BACKEND_OP_MOD_INFO, /* Sample bypass mode: info. */ + ROGUE_BACKEND_OP_MOD_BOTH, /* Sample bypass mode: both. */ + + ROGUE_BACKEND_OP_MOD_BYPASS, /* MCU cache mode (read): bypass. */ + ROGUE_BACKEND_OP_MOD_FORCELINEFILL, /* MCU cache mode (read): force line + * fill. + */ + + ROGUE_BACKEND_OP_MOD_WRITETHROUGH, /* MCU cache mode (write): write through + * L1 & SLC. + */ + ROGUE_BACKEND_OP_MOD_WRITEBACK, /* MCU cache mode (write): write back. */ + ROGUE_BACKEND_OP_MOD_LAZYWRITEBACK, /* MCU cache mode (write): lazy write + * back. + */ + + ROGUE_BACKEND_OP_MOD_SLCBYPASS, /* SLC cache mode: bypass.*/ + ROGUE_BACKEND_OP_MOD_SLCWRITEBACK, /* SLC cache mode: write back */ + ROGUE_BACKEND_OP_MOD_SLCWRITETHROUGH, /* SLC cache mode: write through. */ + ROGUE_BACKEND_OP_MOD_SLCNOALLOC, /* SLC cache mode: cached reads/no + * allocation on miss. + */ + + ROGUE_BACKEND_OP_MOD_ARRAY, /* Sample data contains array index/texture + * arrays enabled. + */ + ROGUE_BACKEND_OP_MOD_INTEGER, /* Integer co-ordinates and sample data. */ + ROGUE_BACKEND_OP_MOD_SCHEDSWAP, /* Deschedule slot after instruction. */ + + ROGUE_BACKEND_OP_MOD_F16, /* Return packed F16 data. */ + ROGUE_BACKEND_OP_MOD_SAT, /* Saturate output. */ ROGUE_BACKEND_OP_MOD_COUNT, diff --git a/src/imagination/rogue/rogue_backend_instrs.def b/src/imagination/rogue/rogue_backend_instrs.def index ea9c19715c0..d752c67e464 100644 --- a/src/imagination/rogue/rogue_backend_instrs.def +++ b/src/imagination/rogue/rogue_backend_instrs.def @@ -49,6 +49,10 @@ #define ROGUE_BUILDER_DEFINE_BACKEND14(...) #endif /* ROGUE_BUILDER_DEFINE_BACKEND14 */ +#ifndef ROGUE_BUILDER_DEFINE_BACKEND16 +#define ROGUE_BUILDER_DEFINE_BACKEND16(...) +#endif /* ROGUE_BUILDER_DEFINE_BACKEND16 */ + ROGUE_BUILDER_DEFINE_BACKEND00(UVSW_EMIT) ROGUE_BUILDER_DEFINE_BACKEND00(UVSW_ENDTASK) ROGUE_BUILDER_DEFINE_BACKEND00(UVSW_EMITTHENENDTASK) @@ -61,6 +65,11 @@ ROGUE_BUILDER_DEFINE_BACKEND13(FITR_PIXEL) ROGUE_BUILDER_DEFINE_BACKEND14(FITRP_PIXEL) +ROGUE_BUILDER_DEFINE_BACKEND16(SMP1D) +ROGUE_BUILDER_DEFINE_BACKEND16(SMP2D) +ROGUE_BUILDER_DEFINE_BACKEND16(SMP3D) + +#undef ROGUE_BUILDER_DEFINE_BACKEND16 #undef ROGUE_BUILDER_DEFINE_BACKEND14 #undef ROGUE_BUILDER_DEFINE_BACKEND13 #undef ROGUE_BUILDER_DEFINE_BACKEND11 diff --git a/src/imagination/rogue/rogue_builder.c b/src/imagination/rogue/rogue_builder.c index 6c0f1c50ec3..7c0f508917a 100644 --- a/src/imagination/rogue/rogue_builder.c +++ b/src/imagination/rogue/rogue_builder.c @@ -277,6 +277,22 @@ rogue_build_backend14(rogue_builder *b, return rogue_build_backend(b, op, 1, dsts, 4, srcs); } +static inline rogue_backend_instr * +rogue_build_backend16(rogue_builder *b, + enum rogue_backend_op op, + rogue_ref dst0, + rogue_ref src0, + rogue_ref src1, + rogue_ref src2, + rogue_ref src3, + rogue_ref src4, + rogue_ref src5) +{ + rogue_ref dsts[] = { dst0 }; + rogue_ref srcs[] = { src0, src1, src2, src3, src4, src5 }; + return rogue_build_backend(b, op, 1, dsts, 6, srcs); +} + #define ROGUE_BUILDER_DEFINE_BACKEND00(op) \ PUBLIC \ rogue_backend_instr *rogue_##op(rogue_builder *b) \ @@ -335,6 +351,30 @@ rogue_build_backend14(rogue_builder *b, src3); \ } +#define ROGUE_BUILDER_DEFINE_BACKEND16(op) \ + PUBLIC \ + rogue_backend_instr *rogue_##op(rogue_builder *b, \ + rogue_ref dst0, \ + rogue_ref src0, \ + rogue_ref src1, \ + rogue_ref src2, \ + rogue_ref src3, \ + rogue_ref src4, \ + rogue_ref src5) \ + { \ + assert(rogue_backend_op_infos[ROGUE_BACKEND_OP_##op].num_dsts == 1); \ + assert(rogue_backend_op_infos[ROGUE_BACKEND_OP_##op].num_srcs == 6); \ + return rogue_build_backend16(b, \ + ROGUE_BACKEND_OP_##op, \ + dst0, \ + src0, \ + src1, \ + src2, \ + src3, \ + src4, \ + src5); \ + } + #include "rogue_backend_instrs.def" static inline rogue_ctrl_instr *rogue_build_ctrl(rogue_builder *b, diff --git a/src/imagination/rogue/rogue_builder.h b/src/imagination/rogue/rogue_builder.h index 7f03082faea..812f5693553 100644 --- a/src/imagination/rogue/rogue_builder.h +++ b/src/imagination/rogue/rogue_builder.h @@ -153,6 +153,16 @@ static inline rogue_block *rogue_push_block(rogue_builder *b) rogue_ref src2, \ rogue_ref src3); +#define ROGUE_BUILDER_DEFINE_BACKEND16(op) \ + rogue_backend_instr *rogue_##op(rogue_builder *b, \ + rogue_ref dst0, \ + rogue_ref src0, \ + rogue_ref src1, \ + rogue_ref src2, \ + rogue_ref src3, \ + rogue_ref src4, \ + rogue_ref src5); + #include "rogue_backend_instrs.def" /* Ctrl instructions. */ diff --git a/src/imagination/rogue/rogue_encode.c b/src/imagination/rogue/rogue_encode.c index aa44a31adeb..598edac709e 100644 --- a/src/imagination/rogue/rogue_encode.c +++ b/src/imagination/rogue/rogue_encode.c @@ -386,6 +386,143 @@ static void rogue_encode_backend_instr(const rogue_backend_instr *backend, break; } + case ROGUE_BACKEND_OP_SMP1D: + case ROGUE_BACKEND_OP_SMP2D: + case ROGUE_BACKEND_OP_SMP3D: + instr_encoding->backend.op = BACKENDOP_DMA; + instr_encoding->backend.dma.dmaop = DMAOP_SMP; + + instr_encoding->backend.dma.smp.drc = + rogue_ref_get_drc_index(&backend->src[0].ref); + instr_encoding->backend.dma.smp.fcnorm = + rogue_backend_op_mod_is_set(backend, OM(FCNORM)); + + if (rogue_backend_op_mod_is_set(backend, OM(BIAS))) + instr_encoding->backend.dma.smp.lodm = LODM_BIAS; + else if (rogue_backend_op_mod_is_set(backend, OM(REPLACE))) + instr_encoding->backend.dma.smp.lodm = LODM_REPLACE; + else if (rogue_backend_op_mod_is_set(backend, OM(GRADIENT))) + instr_encoding->backend.dma.smp.lodm = LODM_GRADIENTS; + else + instr_encoding->backend.dma.smp.lodm = LODM_NORMAL; + + switch (rogue_ref_get_val(&backend->src[5].ref)) { + case 1: + instr_encoding->backend.dma.smp.chan = SMPCHAN_1; + break; + + case 2: + instr_encoding->backend.dma.smp.chan = SMPCHAN_2; + break; + + case 3: + instr_encoding->backend.dma.smp.chan = SMPCHAN_3; + break; + + case 4: + instr_encoding->backend.dma.smp.chan = SMPCHAN_4; + break; + + default: + unreachable("Unsupported number of channels."); + } + + switch (backend->op) { + case ROGUE_BACKEND_OP_SMP1D: + instr_encoding->backend.dma.smp.dmn = DMN_1D; + break; + + case ROGUE_BACKEND_OP_SMP2D: + instr_encoding->backend.dma.smp.dmn = DMN_2D; + break; + + case ROGUE_BACKEND_OP_SMP3D: + instr_encoding->backend.dma.smp.dmn = DMN_3D; + break; + + default: + unreachable("Unsupported sampler op."); + } + + if (instr_size > 2) { + instr_encoding->backend.dma.smp.exta = 1; + + instr_encoding->backend.dma.smp.tao = + rogue_backend_op_mod_is_set(backend, OM(TAO)); + instr_encoding->backend.dma.smp.soo = + rogue_backend_op_mod_is_set(backend, OM(SOO)); + instr_encoding->backend.dma.smp.sno = + rogue_backend_op_mod_is_set(backend, OM(SNO)); + instr_encoding->backend.dma.smp.nncoords = + rogue_backend_op_mod_is_set(backend, OM(NNCOORDS)); + + if (rogue_backend_op_mod_is_set(backend, OM(DATA))) + instr_encoding->backend.dma.smp.sbmode = SBMODE_DATA; + else if (rogue_backend_op_mod_is_set(backend, OM(INFO))) + instr_encoding->backend.dma.smp.sbmode = SBMODE_INFO; + else if (rogue_backend_op_mod_is_set(backend, OM(BOTH))) + instr_encoding->backend.dma.smp.sbmode = SBMODE_BOTH; + else + instr_encoding->backend.dma.smp.sbmode = SBMODE_NONE; + + instr_encoding->backend.dma.smp.proj = + rogue_backend_op_mod_is_set(backend, OM(PROJ)); + instr_encoding->backend.dma.smp.pplod = + rogue_backend_op_mod_is_set(backend, OM(PPLOD)); + } + + if (instr_size >= 3) { + instr_encoding->backend.dma.smp.extb = 1; + + instr_encoding->backend.dma.smp.w = + rogue_backend_op_mod_is_set(backend, OM(WRT)); + + if (rogue_backend_op_mod_is_set(backend, OM(BYPASS))) { + instr_encoding->backend.dma.smp.cachemode = CACHEMODE_LD_BYPASS; + } else if (rogue_backend_op_mod_is_set(backend, OM(FORCELINEFILL))) { + instr_encoding->backend.dma.smp.cachemode = + CACHEMODE_LD_FORCE_LINE_FILL; + } else if (rogue_backend_op_mod_is_set(backend, OM(WRITETHROUGH))) { + instr_encoding->backend.dma.smp.cachemode = + CACHEMODE_ST_WRITE_THROUGH; + } else if (rogue_backend_op_mod_is_set(backend, OM(WRITEBACK))) { + instr_encoding->backend.dma.smp.cachemode = CACHEMODE_ST_WRITE_BACK; + } else if (rogue_backend_op_mod_is_set(backend, OM(LAZYWRITEBACK))) { + instr_encoding->backend.dma.smp.cachemode = + CACHEMODE_ST_WRITE_BACK_LAZY; + } else { + instr_encoding->backend.dma.smp.cachemode = + CACHEMODE_LD_NORMAL; /* == CACHEMODE_ST_WRITE_THROUGH */ + } + + instr_encoding->backend.dma.smp.swap = + rogue_backend_op_mod_is_set(backend, OM(SCHEDSWAP)); + instr_encoding->backend.dma.smp.f16 = + rogue_backend_op_mod_is_set(backend, OM(F16)); + + if (rogue_backend_op_mod_is_set(backend, OM(SLCWRITEBACK))) { + instr_encoding->backend.dma.smp.slccachemode = + SLCCACHEMODE_WRITE_BACK; + } else if (rogue_backend_op_mod_is_set(backend, OM(SLCWRITETHROUGH))) { + instr_encoding->backend.dma.smp.slccachemode = + SLCCACHEMODE_WRITE_THROUGH; + } else if (rogue_backend_op_mod_is_set(backend, OM(SLCNOALLOC))) { + instr_encoding->backend.dma.smp.slccachemode = + SLCCACHEMODE_CACHED_READS; + } else { + instr_encoding->backend.dma.smp.slccachemode = SLCCACHEMODE_BYPASS; + } + } + + if (instr_size > 4) { + instr_encoding->backend.dma.smp.extc = 1; + + instr_encoding->backend.dma.smp.array = + rogue_backend_op_mod_is_set(backend, OM(ARRAY)); + } + + break; + default: unreachable("Unsupported backend op."); } diff --git a/src/imagination/rogue/rogue_info.c b/src/imagination/rogue/rogue_info.c index afe8180d1ae..6d0212fcb2f 100644 --- a/src/imagination/rogue/rogue_info.c +++ b/src/imagination/rogue/rogue_info.c @@ -300,6 +300,60 @@ const rogue_backend_op_info rogue_backend_op_infos[ROGUE_BACKEND_OP_COUNT] = { [1] = 3, [2] = ~0U, }, + }, + [ROGUE_BACKEND_OP_SMP1D] = { .str = "smp1d", .num_dsts = 1, .num_srcs = 6, + .phase_io = { .dst[0] = IO(S4), .src[1] = IO(S0), .src[2] = IO(S1), .src[3] = IO(S2), }, + .supported_op_mods = OM(PROJ) | OM(FCNORM) | OM(NNCOORDS) | OM(BIAS) | OM(REPLACE) | + OM(GRADIENT) | OM(PPLOD) | OM(TAO) | OM(SOO) | OM(SNO) | OM(WRT) | OM(DATA) | + OM(INFO) | OM(BOTH) | OM(BYPASS) | OM(FORCELINEFILL) | OM(WRITETHROUGH) | + OM(WRITEBACK) | OM(LAZYWRITEBACK) | OM(SLCBYPASS) | OM(SLCWRITEBACK) | + OM(SLCWRITETHROUGH) | OM(SLCNOALLOC) | OM(ARRAY) | OM(INTEGER) | OM(SCHEDSWAP) | + OM(F16), + .supported_dst_types = { [0] = T(REG) | T(REGARRAY), }, + .supported_src_types = { + [0] = T(DRC), + [1] = T(REGARRAY), + [2] = T(REG) | T(REGARRAY), + [3] = T(REGARRAY), + [4] = T(REG) | T(IO), + [5] = T(VAL), + }, + }, + [ROGUE_BACKEND_OP_SMP2D] = { .str = "smp2d", .num_dsts = 1, .num_srcs = 6, + .phase_io = { .dst[0] = IO(S4), .src[1] = IO(S0), .src[2] = IO(S1), .src[3] = IO(S2), }, + .supported_op_mods = OM(PROJ) | OM(FCNORM) | OM(NNCOORDS) | OM(BIAS) | OM(REPLACE) | + OM(GRADIENT) | OM(PPLOD) | OM(TAO) | OM(SOO) | OM(SNO) | OM(WRT) | OM(DATA) | + OM(INFO) | OM(BOTH) | OM(BYPASS) | OM(FORCELINEFILL) | OM(WRITETHROUGH) | + OM(WRITEBACK) | OM(LAZYWRITEBACK) | OM(SLCBYPASS) | OM(SLCWRITEBACK) | + OM(SLCWRITETHROUGH) | OM(SLCNOALLOC) | OM(ARRAY) | OM(INTEGER) | OM(SCHEDSWAP) | + OM(F16), + .supported_dst_types = { [0] = T(REG) | T(REGARRAY), }, + .supported_src_types = { + [0] = T(DRC), + [1] = T(REGARRAY), + [2] = T(REG) | T(REGARRAY), + [3] = T(REGARRAY), + [4] = T(REG) | T(IO), + [5] = T(VAL), + }, + }, + [ROGUE_BACKEND_OP_SMP3D] = { .str = "smp3d", .num_dsts = 1, .num_srcs = 6, + .phase_io = { .dst[0] = IO(S4), .src[1] = IO(S0), .src[2] = IO(S1), .src[3] = IO(S2), }, + .supported_op_mods = OM(PROJ) | OM(FCNORM) | OM(NNCOORDS) | OM(BIAS) | OM(REPLACE) | + OM(GRADIENT) | OM(PPLOD) | OM(TAO) | OM(SOO) | OM(SNO) | OM(WRT) | OM(DATA) | + OM(INFO) | OM(BOTH) | OM(BYPASS) | OM(FORCELINEFILL) | OM(WRITETHROUGH) | + OM(WRITEBACK) | OM(LAZYWRITEBACK) | OM(SLCBYPASS) | OM(SLCWRITEBACK) | + OM(SLCWRITETHROUGH) | OM(SLCNOALLOC) | OM(ARRAY) | OM(INTEGER) | OM(SCHEDSWAP) | + OM(F16), + .supported_dst_types = { [0] = T(REG) | T(REGARRAY), }, + .supported_src_types = { + [0] = T(DRC), + [1] = T(REGARRAY), + [2] = T(REG) | T(REGARRAY), + [3] = T(REGARRAY), + [4] = T(REG) | T(IO), + [5] = T(VAL), + }, }, }; #undef B @@ -308,7 +362,43 @@ const rogue_backend_op_info rogue_backend_op_infos[ROGUE_BACKEND_OP_COUNT] = { #undef IO const rogue_backend_op_mod_info rogue_backend_op_mod_infos[ROGUE_BACKEND_OP_MOD_COUNT] = { - [ROGUE_BACKEND_OP_MOD_SAT] = { .str = "sat", }, + [ROGUE_BACKEND_OP_MOD_PROJ] = { .str = "proj", }, + [ROGUE_BACKEND_OP_MOD_FCNORM] = { .str = "fcnorm", }, + [ROGUE_BACKEND_OP_MOD_NNCOORDS] = { .str = "nncoords", }, + + [ROGUE_BACKEND_OP_MOD_BIAS] = { .str = "bias", }, + [ROGUE_BACKEND_OP_MOD_REPLACE] = { .str = "replace", }, + [ROGUE_BACKEND_OP_MOD_GRADIENT] = { .str = "gradient", }, + + [ROGUE_BACKEND_OP_MOD_PPLOD] = { .str = "pplod", }, + [ROGUE_BACKEND_OP_MOD_TAO] = { .str = "tao", }, + [ROGUE_BACKEND_OP_MOD_SOO] = { .str = "soo", }, + [ROGUE_BACKEND_OP_MOD_SNO] = { .str = "sno", }, + [ROGUE_BACKEND_OP_MOD_WRT] = { .str = "wrt", }, + + [ROGUE_BACKEND_OP_MOD_DATA] = { .str = "data", }, + [ROGUE_BACKEND_OP_MOD_INFO] = { .str = "info", }, + [ROGUE_BACKEND_OP_MOD_BOTH] = { .str = "both", }, + + [ROGUE_BACKEND_OP_MOD_BYPASS] = { .str = "bypass", }, + [ROGUE_BACKEND_OP_MOD_FORCELINEFILL] = { .str = "forcelinefill", }, + + [ROGUE_BACKEND_OP_MOD_WRITETHROUGH] = { .str = "writethrough", }, + [ROGUE_BACKEND_OP_MOD_WRITEBACK] = { .str = "writeback", }, + [ROGUE_BACKEND_OP_MOD_LAZYWRITEBACK] = { .str = "lazywriteback", }, + + [ROGUE_BACKEND_OP_MOD_SLCBYPASS] = { .str = "slcbypass", }, + [ROGUE_BACKEND_OP_MOD_SLCWRITEBACK] = { .str = "slcwriteback", }, + [ROGUE_BACKEND_OP_MOD_SLCWRITETHROUGH] = { .str = "slcwritethrough", }, + [ROGUE_BACKEND_OP_MOD_SLCNOALLOC] = { .str = "slcnoalloc", }, + + [ROGUE_BACKEND_OP_MOD_ARRAY] = { .str = "array", }, + [ROGUE_BACKEND_OP_MOD_INTEGER] = { .str = "integer", }, + [ROGUE_BACKEND_OP_MOD_SCHEDSWAP] = { .str = "schedswap", }, + + [ROGUE_BACKEND_OP_MOD_F16] = { .str = "f16", }, + + [ROGUE_BACKEND_OP_MOD_SAT] = { .str = "sat", }, }; #define P(type) BITFIELD64_BIT(ROGUE_INSTR_PHASE_##type) diff --git a/src/imagination/rogue/rogue_isa.h b/src/imagination/rogue/rogue_isa.h index d0d3ab6bebe..2035db423e4 100644 --- a/src/imagination/rogue/rogue_isa.h +++ b/src/imagination/rogue/rogue_isa.h @@ -845,6 +845,86 @@ enum slccachemode { SLCCACHEMODE_CACHED_READS = 0b11, }; +typedef struct rogue_backend_dma_smp_encoding { + /* Byte 0 */ + struct { + unsigned : 3; + unsigned drc : 1; + unsigned fcnorm : 1; + unsigned : 3; + } PACKED; + + /* Byte 1 */ + struct { + unsigned lodm : 2; + unsigned chan : 2; + unsigned exta : 1; + unsigned dmn : 2; + unsigned extb : 1; + } PACKED; + + /* Byte 2 */ + struct { + unsigned tao : 1; + unsigned soo : 1; + unsigned sno : 1; + unsigned nncoords : 1; + unsigned sbmode : 2; + unsigned proj : 1; + unsigned pplod : 1; + } PACKED; + + /* Byte 3 */ + struct { + unsigned w : 1; + unsigned cachemode : 2; + unsigned swap : 1; + unsigned f16 : 1; + unsigned slccachemode : 2; + unsigned extc : 1; + } PACKED; + + /* Byte 4 */ + struct { + unsigned array : 1; + unsigned : 7; + } PACKED; +} PACKED rogue_backend_dma_smp_encoding; +static_assert(sizeof(rogue_backend_dma_smp_encoding) == 5, + "sizeof(rogue_backend_dma_smp_encoding) != 5"); + +enum fcnorm { + FCNORM_INT_NOCONVFP = 0, + FCNORM_FIXED_CONVFP = 1, +}; + +enum lodm { + LODM_NORMAL = 0b00, + LODM_BIAS = 0b01, + LODM_REPLACE = 0b10, + LODM_GRADIENTS = 0b11, +}; + +enum smpchan { + SMPCHAN_1 = 0b00, + SMPCHAN_2 = 0b01, + SMPCHAN_3 = 0b10, + SMPCHAN_4 = 0b11, +}; + +enum dmn { + DMN_1D = 0b01, + DMN_2D = 0b10, + DMN_3D = 0b11, +}; + +enum sbmode { + SBMODE_NONE = 0b00, + SBMODE_DATA = 0b01, + SBMODE_INFO = 0b10, + SBMODE_BOTH = 0b11, +}; + typedef struct rogue_backend_dma_encoding { union { /* Byte 0 */ @@ -853,11 +933,12 @@ typedef struct rogue_backend_dma_encoding { unsigned : 5; } PACKED; + rogue_backend_dma_smp_encoding smp; rogue_backend_dma_ld_encoding ld; } PACKED; } PACKED rogue_backend_dma_encoding; -static_assert(sizeof(rogue_backend_dma_encoding) == 3, - "sizeof(rogue_backend_dma_encoding) != 3"); +static_assert(sizeof(rogue_backend_dma_encoding) == 5, + "sizeof(rogue_backend_dma_encoding) != 5"); enum dmaop { DMAOP_IDF = 0b000, @@ -881,8 +962,8 @@ typedef struct rogue_backend_instr_encoding { rogue_backend_dma_encoding dma; } PACKED; } PACKED rogue_backend_instr_encoding; -static_assert(sizeof(rogue_backend_instr_encoding) == 3, - "sizeof(rogue_backend_instr_encoding) != 3"); +static_assert(sizeof(rogue_backend_instr_encoding) == 5, + "sizeof(rogue_backend_instr_encoding) != 5"); enum backendop { BACKENDOP_UVSW = 0b000,