Faith Ekstrand
0e4480d8b3
nak: Add a nir_shader_compiler_options to nak_compiler
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:08 +00:00
Faith Ekstrand
5a86cf2b80
nak: Move nak_compiler to nak_private.h
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:08 +00:00
Faith Ekstrand
2bf9cafbe7
nak: Implement basic control-flow
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:08 +00:00
Faith Ekstrand
1b3382b861
nak: Add modifier propagation
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
495b64be2b
nak: Make Dst its own type
...
Instead of having Src::src_ref and Dst share a type, make them separate
enums. We're not really getting any benefit from them being the same
enum type anymore and this means we avoid things like immediates in
destinations. We can't make the type system do all our work for us but
this seems tractable.
While we're reworking things we also implement From<> for stuff instead
of having quite as many new_*() constructor variants.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
ea2c6c8ebe
nak: Implement Display for SSAValue
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
f26228fca3
nak: One of the predicates in IADD3 is a destination
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
9541036507
nak: Rework source modifiers
...
Just put modifiers on every source. It's too complicated to try and
make the type system work for us here. When the time comes that we
write a validator, we'll just validate them.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
fa8782733d
nak: Rework ALUSrc in emit code
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
f4c0ea24e5
nak: Implement fsign
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
5ad06de4d3
nak: Allow iadd3 to take an immediate in srcs[2]
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
811ccc6917
nak: Implement unary float and integer ops
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
4c057423e8
nak: Implement nir_op_b2f32
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
708d928fbf
nak: Implement float comparisons
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
d11c8268a2
nak: Rework integer compare ops
...
Rename to IntCmpOp and make it trivially copyable. While we're at it,
rename and rework set_int_cmp_op() in the emit code too.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
3a17c943da
nak: Implement fadd
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
5935c62d4e
nak: Implement i2f
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
8adeae1dc2
nak: Handle zeroes at emit time
...
Rework our helpers to take Src and Dst and handle zeros inside the
helpers. This is better because, at emit time, we actually have the
information about which register file to use.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
1730600943
nak: Use Src::Zero for load_const(0)
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
b41b4bd7f5
nak: Use a different inner struct type for each opcode
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
e994acdb36
nak: Add a SrcModsAsSlice trait
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
6e5f6476e3
nak: Add SrcAsSlice and DstAsSlice traits
...
We also add a proc macro which auto-derives these traits for structs for
which all sources/destinations are contiguous.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
5a80c2e89a
meson: Pull in syn from crates.io
...
We don't have real crates.io support yet so this uses a hack where it
pulls wraps from my personal github.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
384f4448e1
nak: Get rid of meta instructions
...
They're mostly in the way at this point. Instead, make map_instrs return
a Vec<Instr>. We can reaplace that with a None, One, Some enum type
later if we want.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
438c67c1cb
nak: Use Instr::num_srcs/dsts() less
...
Instead use Iterator::enumerate() and is_empty().
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
fafb72e2be
HACK: Support old meson
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
44243c4741
nak: Lower 8 and 16-bit types
...
We can do some of these on some hardware but we'll lower them all for
now.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
8f121036ea
nak: Implement boolean logic ops
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
871bb59875
nak: Rework instruction encoding
...
Use a struct to store the temporary data and the SM number and over-all
reduce the amount of stuff we have to pass around. Also, rename
everything from tu102 to sm75 which is a more apt description.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
5207d9e3a0
nak: Encode load/store correctly on SM80
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
5daff0876f
nak: Plumb the SM through to nak::Shader
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
611ed96557
nvk: Pass an actual nak_compiler to nak_compile_shader()
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
bf72e78e0a
nak: Add nak_compiler_create/destroy
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
c10aa56efb
nak/meson: Use bindgen dependencies
...
These are new in meson 1.0 and lets us avoid all that manual include
directory mangling which was going to break one of these days anyway.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
e69a30cecb
nak: Rework ALU instruction encode
...
Instead of pulling sources from fixed locations in the instruction, take
a bunch of Option<&Ref> and let the individual encode func take care of
it.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
0e755f9964
nak: Implement bcsel
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
b3d6dafc7d
nak: Implement integer comparisons
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
ac2a56f56f
nak: Add support for instruction predicates
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
de073a10e6
nak: Implement 32-bit logic ops
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
8cf12d6a3f
nak: Add a pass for computing instruction dependencies
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
93eb2f884a
nak: Implement iadd and ishl
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
241caaf5ff
nak: Add an instruction fuzzing tool
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
90d3fd10e1
nak: Zero out the .w component of descriptors
...
This saves us from having to constantly add it in as we compute
addresses.
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
c212506771
nak: Implement load/store_global
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
c76331fb51
nak: Implement load_ubo
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
62f5e65c80
nak: Implement load_sysval_nv as S2R
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
fb96aaf3fa
nak: Lower system values to a new load_sysval_nak intrinsic
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
481a29a912
nak: Header stuff
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:07 +00:00
Faith Ekstrand
80376146ed
nak: Encode program headers
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:06 +00:00
Faith Ekstrand
50b1deefa7
nak: Add encoding for a few instructions
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/24998 >
2023-11-14 00:48:06 +00:00