Faith Ekstrand
d1c56b12b9
nak: Implement nir_intrinsic_global_atomic_*
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
18a11aa449
nak: Rework copy-prop to use soruce type decorations
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
9bc2bdd78f
nak: Add a Src::supports_src_type() helper
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
42d31b4bfd
nak: Rework source modifiers a bit
...
They now carry some type informaiton so FNeg and INeg are different
modifiers. Since only INeg exists in hardware, we don't need IAbs or
INegAbs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
a2390fdbc1
nak: Only divide FS inputs by .w for smooth interpolation
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
7398a262da
nak: Decorate sources with types
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
4def64545a
nak: Add a mechanism for decorating sources with types
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
3207f29a09
nak: Integers don't have abs() source modifiers
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
2a2103d73b
nak: Implement load/store_shared
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
73976c3f31
nvk: Plumb num_barriers through from NAK
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
4c2ce288f9
nak: Implement barriers
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
53a372ec3d
nak: Add F2F and implement fquantize16
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
dc3b2c7d10
nak: sin() and cos() require we divide by 2pi
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
a6e1167a83
nak: Don't allow r255 in texture or surface ops
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Daniel Almeida
b70d998180
nak: compiler: replace Instr::new(..) with OpFoo {}.into()
...
As Instr now implements From<T: Into<Op>>, replace
Instr::new(Op::Foo(OpFoo {})) with OpFoo {}.into() to improve
readability.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Daniel Almeida
ab9cf27c02
nak: compiler: add From<T:Into<Op>> for Instr
...
Adding this From implementation makes it possible to clean up
the code in the next commit.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
e8f220f7a1
nak: Legalize Op[FI]Setp
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
3bd42dd254
nak: Improve [FI]SETP encoding
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
3ac03b043e
nak/nir: Lower image size and samples to txq
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:10 +00:00
Faith Ekstrand
6750d21e65
nak: Legalize more stuff
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
854b4c0817
nak: Only put actually live SSA values in the ra.live_in sets
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
49f8fb0c03
nak: Legalize OpShf
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
4e4548afc9
nak: Improve RA failure messages
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
3c7a837c51
nak: Add a smarter new_lop2 helper
...
The new helper automatically detects whether you're working with
predicates or GPRs.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
a36a614583
nak: Implement nir_intrinsic_load/store_scratch
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
a4ea83777b
nak: Wire up OpLd and OpSt for local and shared
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
840c0281ce
nak: Implement image load/store
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
9d2b81e71d
nak: Implement undef instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
2387dfdf6b
nak: Implement nir_op_ixor
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
6ab0d7ee23
Revert "HACK: nak: Lower iadd64 again"
...
This reverts commit 88b14e4ab9e272bfb33bea4057aacbdd5a16ae5b.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
6e5c960434
nak: Implement nir_op[iu]mul_2x32_64
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
392d3791a8
nak: Much more believable try_find_unused_reg_range()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
f3e1379bdf
nak: Add a use tracker to RA
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
10deb1d62b
nak: Legalize vector sources
...
It is possible for a single scalar to show up in any number of vector
components, including twice in the same vector. Add a bit to the
legalization pass to deal with this possibility.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
9ef47c8921
nak: Rework vector handling
...
Previously, we handled vectors by giving each SSAValue a number of
components which we assume matches in all uses. To deal with swizzles
and component selection, we had OpVec and OpSplit instructions to
convert vectors to/from scalars as-needed. This is fine as an SSA
representation but it leads to a lot of redundant values when it comes
time for assigning registers. There are strategies for dealing with
this such as ensuring that splits always kill the whole vector and then
re-combining into a new vector for later uses. It's possible by doing
this to ensure that each component only ever exists exactly once at the
cost of a LOT of vec/split instructions.
Another possible solution is to naievely emit vec/split but teach
liveness analysis and RA bout the duplicated values. Instead of RA
working on individual SSA values, it can work on equivalence classes of
components.
This takes a different (and currently novel to Mesa) approach of making
each SSAValue a single component but having an SSARef type which can
reference up to 4 SSAValues as a vector. Register allocation then works
on individual components and only ensures that the components of a
vector are contiguous when it's used as a vector. This isn't very
different from how it worked before. If anything, it's a bit more
straightforward now because the component/vector split uses the same
types as the rest of the IR and the SSAComp is gone.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
a9e79994a7
nak: Add a debug flag to assign worst-case instruction deps
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
e3222b2227
nvk: Pass NAK flags through to shader cache UUIDs
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
a41ab7535e
nvk: Drop printing of NAK shaders
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
9daa595ee3
nak: Add a NAK_DEBUG environment variable
...
Also, hide printing behind it and clean up the print code a bit.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
4c81f87670
HACK: spirv: Add a MESA_SPIRV_DUMP_PATH environment variable
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
145f43a9a1
nak: Simplify the (Srcs|Dsts)AsSlice proc macro
...
Instead of building a token stream for the size, just parse it as a
usize. This is way simpler.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Daniel Almeida
09216cd9f4
nak: make Instr::new() generic
...
The previous signature for Instr::new() was too restrictive in that it
would create a new Instr from Op, but not from T: Into<Op>.
Fix that by introducing a generic version instead.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
b448151925
nak: Simplify the FromVariants proc macro
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Daniel Almeida
fc3ef0a251
nak: derive From<OpFoo> for Op through a proc macro
...
Derive From<OpFoo> for Op through a proc macro. This is much less
verbose than adding a manual impl From {..} for all Ops in the
NAK IR.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
a70423944b
nak: Wire up texture ops
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
9d7e1d515f
nak: Use more core NIR texture lowering
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
ad01fbdda0
nak: Add a NIR texture lowering pass
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
31ecffa3a3
nak: Enable nir_lower_idiv
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
c21550e596
nak: Implement nir_op_[iu]mul[_high]
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00
Faith Ekstrand
1825f54d79
nak: Implement right-shifts
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:09 +00:00