Alyssa Rosenzweig
bcb2cf9688
agx: Write to r0l with a "nesting" instruction
...
This avoids modeling the r0l register explicitly in the IR, which would
complicate RA for little benefit at this stage. Do the simplest thing
that could possibly work in SSA.
glmark2 subset.
total instructions in shared programs: 6442 -> 6442 (0.00%)
instructions in affected programs: 701 -> 701 (0.00%)
helped: 4
HURT: 5
helped stats (abs) min: 1.0 max: 3.0 x̄: 2.00 x̃: 2
helped stats (rel) min: 1.46% max: 7.69% x̄: 4.03% x̃: 3.48%
HURT stats (abs) min: 1.0 max: 3.0 x̄: 1.60 x̃: 1
HURT stats (rel) min: 0.81% max: 7.41% x̄: 2.67% x̃: 1.14%
95% mean confidence interval for instructions value: -1.58 1.58
95% mean confidence interval for instructions %-change: -3.70% 3.08%
Inconclusive result (value mean confidence interval includes 0).
total bytes in shared programs: 42196 -> 42186 (-0.02%)
bytes in affected programs: 7768 -> 7758 (-0.13%)
helped: 8
HURT: 5
helped stats (abs) min: 2.0 max: 18.0 x̄: 7.25 x̃: 4
helped stats (rel) min: 0.13% max: 7.26% x̄: 2.02% x̃: 0.97%
HURT stats (abs) min: 6.0 max: 18.0 x̄: 9.60 x̃: 6
HURT stats (rel) min: 0.82% max: 6.32% x̄: 2.37% x̃: 1.02%
95% mean confidence interval for bytes value: -7.02 5.48
95% mean confidence interval for bytes %-change: -2.30% 1.63%
Inconclusive result (value mean confidence interval includes 0).
total halfregs in shared programs: 1926 -> 1769 (-8.15%)
halfregs in affected programs: 1395 -> 1238 (-11.25%)
helped: 71
HURT: 0
helped stats (abs) min: 1.0 max: 10.0 x̄: 2.21 x̃: 2
helped stats (rel) min: 1.92% max: 52.63% x̄: 15.33% x̃: 11.76%
95% mean confidence interval for halfregs value: -2.69 -1.73
95% mean confidence interval for halfregs %-change: -17.98% -12.68%
Halfregs are helped.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
c9a96d4615
agx: Preload vertex/instance ID only at start
...
This means we don't reserve the registers, which improves RA
considerably. Using a special preload psuedo-op instead of a regular
move allows us to constrain semantics and gaurantee coalescing.
shader-db on glmark2 subset:
total instructions in shared programs: 6448 -> 6442 (-0.09%)
instructions in affected programs: 230 -> 224 (-2.61%)
helped: 4
HURT: 0
total bytes in shared programs: 42232 -> 42196 (-0.09%)
bytes in affected programs: 1530 -> 1494 (-2.35%)
helped: 4
HURT: 0
total halfregs in shared programs: 2291 -> 1926 (-15.93%)
halfregs in affected programs: 2185 -> 1820 (-16.70%)
helped: 75
HURT: 0
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
f665229d77
agx: Print agx_dim appropriately
...
Easier to read, and gets us closer to proper disasm in Mesa.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
1dcaade3e2
agx: Rename "combine" to "collect"
...
For consistency with ir3 and bifrost.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
82e8e709cb
agx: Dynamically size split instruction
...
This is more flexible.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
7c9fba34bc
agx: Switch to dynamic allocation of srcs/dests
...
So we can handle parallel copies later.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
c2bc8c1384
agx: Don't prefix pseudo-ops
...
It's not really buying us anything and it clutters the IR.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18804 >
2022-10-14 01:37:39 +00:00
Alyssa Rosenzweig
5cd2371318
agx: Pass mask into ld/st_tile instructions
...
Properly handle render target formats with <4 components.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18687 >
2022-09-22 03:23:36 +00:00
Alyssa Rosenzweig
640fd089a2
agx: Ensure that the optimizer sees legitimate SSA
...
Expecting it to keep around unused definitions around is wishful. Add an
"anchoring" unit_test instruction to consume the results so they don't
have to be precoloured registers.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18687 >
2022-09-22 03:23:36 +00:00
Alyssa Rosenzweig
7a4e0a4d35
agx: Implement texture offsets and comparators
...
Texture offsets and shadow comparison values get grouped into a vector
passed by register. Comparison values are provided as-is (fp32). Texture
offsets are packed into nibbles, but we can do this on the CPU, as
nonconstant offsets are forbidden in GLSL at least. They're also
forbidden in Vulkan/SPIR-V without ImageGatherExtended/
shaderImageGatherExtended. I'm happy kicking the NIR lowering can down
the line, this commit is complicated enough already.
Passes dEQP-GLES3.functional.shaders.texture_functions.texture.* and
dEQP-GLES3.functional.shaders.texture_functions.textureoffset.*
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18525 >
2022-09-13 16:04:29 +00:00
Alyssa Rosenzweig
4f85a7be8c
agx: Make p_combine take a dynamic src count
...
For larger vectors.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18525 >
2022-09-13 16:04:28 +00:00
Alyssa Rosenzweig
10c9aceadf
agx: Plumb through nir_op_txf
...
nir_op_txf maps to AGX's texture_load, which is encoded like
texture_sample. The one outstanding question with this commit is the
rules for the sample required ... in NIR and APIs (including Metal), txf
is samplerless, but the AGX instruction consumes a sampler. Hopefully
any sampler will do, though?
Passes dEQP-GLES3.functional.shaders.texture_functions.texelfetch.*
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/18380 >
2022-09-04 18:05:31 +00:00
Alyssa Rosenzweig
17168162fb
agx: Remove p_extract
...
It's now unused. We didn't have coalescing for it anyway, splits are the
preferred alternative.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17198 >
2022-08-07 20:43:54 -04:00
Alyssa Rosenzweig
744b4a0f7f
agx: Rename varying load instructions
...
Unlike Mali (where I borrowed the old names from), these are not loads
in the memory sense. They are simply register loads and arithmetic.
Rename accordingly, using PowerVR names and public Apple names as a
guide.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17198 >
2022-08-07 20:43:53 -04:00
Alyssa Rosenzweig
14bf020d75
agx: Model perspective coefficient reg in the IR
...
For perspective-correct interpolation, the W coefficient register is
needed. Instead of hardcoding this to cf0 and special casing, model this
in the IR and let the general handling kick in.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/17198 >
2022-08-07 20:43:53 -04:00
Alyssa Rosenzweig
a2a947031a
agx: Mark the logical ends of blocks
...
We need to insert parallel copies at the logical end of blocks, before branches.
Add a pseudo instruction signaling that. Cribbed from ACO.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268 >
2022-05-01 22:00:00 -04:00
Alyssa Rosenzweig
d285c63417
agx: Add phi pseudo instruction
...
For SSA.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268 >
2022-05-01 21:58:29 -04:00
Alyssa Rosenzweig
2a4a8a8902
agx: Add p_split pseudoinstruction
...
Easier on RA for extracts.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268 >
2022-05-01 21:58:29 -04:00
Alyssa Rosenzweig
7d38bcb7ee
agx: Use pseudo ops for mov/not/and/xor/or
...
Rather than using builder magic (implicitly lowered on emit), add actual pseudo
operations (explicitly lowered before encoding). In theory this is slower, I
doubt it matters. This makes the instruction aliases first-class for IR prining
and machine inspection, which will make optimization passes easier to write.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268 >
2022-05-01 21:58:29 -04:00
Alyssa Rosenzweig
f0a973081f
agx: Use correct types for some IR enums
...
Otherwise there are implicit int->enum casts which prevent us from building as
C++ (with -fpermissive).
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16268 >
2022-05-01 21:58:29 -04:00
Alyssa Rosenzweig
f248f6623c
agx: Add sample_mask instruction
...
Sets the output sample mask to a given 8-bit immediate or 16-bit
register. Also used to implement discards, which is my ES2 interest.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/14219 >
2022-01-16 18:23:28 +00:00
Alyssa Rosenzweig
3d3e4928b2
agx: Add ld_vary_flat opcode
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11718 >
2021-07-05 20:56:03 +00:00
Alyssa Rosenzweig
10b8563966
agx: Update ld_vary encoding mask
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11718 >
2021-07-05 20:56:03 +00:00
Alyssa Rosenzweig
99b67ab355
agx: Add perspective bit to ld_var
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11718 >
2021-07-05 20:56:03 +00:00
Alyssa Rosenzweig
307b8f1b2f
agx: List sr enum in Python
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11199 >
2021-06-05 20:38:22 +00:00
Alyssa Rosenzweig
cc8fec8b74
agx: Generate enums from Python
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11199 >
2021-06-05 20:38:22 +00:00
Alyssa Rosenzweig
223476aff3
agx: Model get_sr
...
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11199 >
2021-06-05 20:38:22 +00:00
Alyssa Rosenzweig
4fb964ccb8
agx: Model jump instructions
...
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023 >
2021-05-31 01:23:35 +05:30
Alyssa Rosenzweig
4eb8fbf780
agx: Model pop_exec
...
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023 >
2021-05-31 01:23:35 +05:30
Alyssa Rosenzweig
a270665a9e
agx: Model control flow instructions
...
Thankfully the encoding is regular, if a bit complicated.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023 >
2021-05-31 01:23:35 +05:30
Alyssa Rosenzweig
8454d08aa3
agx: Add branch target to IR
...
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023 >
2021-05-31 01:23:35 +05:30
Alyssa Rosenzweig
ad4dfb3321
agx: Add invert_cond (ccn) to IR
...
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023 >
2021-05-31 01:23:35 +05:30
Alyssa Rosenzweig
21cf528e76
agx: Add nest field to IR
...
Needed to model control flow instructions.
Signed-off-by: Alyssa Rosenzweig <alyssa@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11023 >
2021-05-31 01:23:35 +05:30
Alyssa Rosenzweig
1164c992cf
agx: Add ld_tile opcode
...
Variant of st_tile.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10720 >
2021-05-09 23:29:45 -04:00
Alyssa Rosenzweig
07fdc0015e
agx: Rename blend -> st_tile
...
For symmetry.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10720 >
2021-05-09 23:29:45 -04:00
Alyssa Rosenzweig
50b5c94885
agx: Add opcode descriptions as Python
...
Pattern lifted from NIR.
Signed-off-by: Alyssa Rosenzweig <alyssa@rosenzweig.io >
Acked-by: Jason Ekstrand <jason@jlekstrand.net >
Acked-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10582 >
2021-05-02 17:41:09 -04:00