Commit graph

181332 commits

Author SHA1 Message Date
Faith Ekstrand
90a05b5591 nak: Add more legalization
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
b6596b0a53 nak: Wire up ffma
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
c2f72a5782 nak: Implement f2[iu]32
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
0943da1a37 nak: Implement OpFSOut with an OpParCopy
This prevents ordering issues among the sources.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
d6912622f5 nak: Use immediage offsets for load/store_global
In order to facilitate this, we add a little helper in C which uses
nir_ssa_scalar chasing to find an iadd of a thing and an immediate.
This should be reliable as long as we're not lowering iadd64.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
871bd62fe5 nak: Handle multiple vector destinations in RA
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
8c358ce105 nak: Implement input interpolation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
6595abc1e0 nak: Move nak_sysval_attr_addr/sysval_idx higher in the file
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
88f7056d09 nak: Implement MuFu and a bunch of float unops
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
f9f9399773 nak: Implement nir_op_vecN
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:09 +00:00
Faith Ekstrand
0c23df7da2 nak: Implement nir_op_u2f
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
3acb1f80b8 nak: Implement nir_op_(fmin|fmax)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
d86e75e507 nak: Implement nir_op_fmul
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
f2a7cda75a nak: Implement nir_op_[iu](min|max)
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
63dcc7c75a nak: Predicates default to true
The one exception to this is IADD3 where the carry bit default to false
when the default reg (P7) is provided.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
0cbab15de5 nak: Fold [P]Lop3 sources
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
ed42571e83 nak: Implement nir_op_i(eq|ne) for booleans
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
3fd47a68a1 nak: Handle token re-use in dep tracking
When we run out of tokens, instead of panicing, grab the oldest token
and re-use it, adding it to the wait list for the instruction.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
991fa18f6e nak: Improve the dependency tracker
Break the bar/dep allocator out into a helper struct for better
encapsulation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
af752f73dc nak: Add a non-trivial register allocator
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
40fbf6bed2 nak: Add a liveness analysis pass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
3b39778fdd nak: Add a space to the end of vec and split arg lists
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
8004416e38 nak: Rework phis
Have a single phi src/dest instruction per block which handles all the
phis at one go.  This makes phis very similar to parallel copies.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
15a4b620b9 nak: Rework dead-code
It can now handle loops and parallel copies are handled one copy at a
time instead of being handled as a whole instruction.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
ef45379bfa nak: Add an SSAComp struct
This is useful in RA for referring to a single component of an SSA
value.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
552faf2864 nak: Add a BitSet struct
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
d10ff2bdcd nak: Rename BitSetView to BitView
We're about to add a BitSet struct which is like a HashSet and it's an
entirely different concept.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
e1be53e266 nak: Get rid of the BitSet and BitSetMut traits
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
dadf34c620 nak: Use OpParCopy for OpVec and OpSplit lowering
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
df11e232d6 nak: Add a parallel copy in struction with lowering
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
90c098e286 HACK: nak: Lower iadd64 again
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
c68989e49c nak: Don't emit MOVs for overlapping vec and split src/dst
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
b142347797 nak: Drop the special cases for single-component vec/split
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
3fee98d290 nak: Support both destinations in PLOP3
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
9261de6927 nak: Handle phis with non-SSA sources
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
548cb292cf nak: Add separate True and False source types
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
29ecb7acf1 nak: Rename Imm to Imm32
It's always 32-bit as far as I can tell.  We'll do something else for
booleans.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
43e2f1080e WIP: nak: Add a legalization pass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
63707b37d6 nak: Handle fadd funnyness in the emit code
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
df07dd4996 nak: Pass an SSAValueAllocator through to map methods
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
9704772021 nak: Add an SSAValueAllocator struct
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
2b3a883e97 WIP: nak: Rework the barrier assignment pass
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
d0e0e02db7 nak: Implement unpack_64_2x32_split_*
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
2bd71dd0f0 nak: Print names of missing instructions
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
cb50296e3d nak: Lower global access to scalars as needed
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
10efdb47a7 nak: Add a union-find implementation
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
020a7ba8f5 nak: Implement phis
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
520ad0f4a7 nak: Implement iadd64
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
cf533663c1 nak: Implement b2i32
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00
Faith Ekstrand
05ba3f8144 nvk: Pull the NIR options from NAK
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998>
2023-11-14 00:48:08 +00:00