Commit graph

35 commits

Author SHA1 Message Date
Faith Ekstrand
1006283732 nak: Fix shl64 for pre-Volta
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30275>
2024-07-23 03:15:49 +00:00
Faith Ekstrand
e02dfb6a34 nak: Use .wrap for 64-bit shifts
If we set the shift up correctly, we can get the 64-bit wrapping
behavior to work for us instead of adding an instruction to wrap
manually.  While we're at it, set known-unused sources to 0.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30275>
2024-07-23 03:15:49 +00:00
Faith Ekstrand
55901dc287 nak: Add 64-bit shift helpers
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30275>
2024-07-23 03:15:49 +00:00
Faith Ekstrand
da4e368a6f nak: Implement ineg on sm50
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30281>
2024-07-20 16:53:38 +00:00
Faith Ekstrand
71d8126e1b nak/sm50: Split IAdd2 into IAdd2 and IAdd2X
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30281>
2024-07-20 16:53:38 +00:00
Faith Ekstrand
e6b8da5427 nak: Plumb a ShaderModel trait through everywhere
Instead of scattering number checks everywhere, this lets us actually
start splitting code paths.  This commit just adds the shader model
trait.  Later commits will add more methods.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/30141>
2024-07-11 22:28:31 +00:00
Faith Ekstrand
3dfd92888a nak: Add a UniformBuilder
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
f0ec1873df nak: Make SSARef::file() return Option<RegFile>
Once we start using UGPRs, it's possible to have a vector with a mix of
GPRs and UGPRs.  This isn't actually allowed by the hardware but it's
possible as an intermediate state thanks to copy-propagation.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
Faith Ekstrand
fe2b06395e nak: Get rid of OpINeg
Instead, do the same thing we do for float modifiers and use OpIAdd2 or
OpIAdd3.  This makes for a little more work in copy-prop but the extra
opcode and lowering pass just isn't worth it.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29591>
2024-06-13 20:43:45 +00:00
M Henning
1fb74672a9 nak: Use undef for unset FSOut components
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27742>
2024-04-09 20:13:16 +00:00
Mary Guillemard
567cae69c3 nak: Add 16-bits float operations
Signed-off-by: Mary Guillemard <mary.guillemard@collabora.com>
Reviewed-by: Faith Ekstrand <faith.ekstrand@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27635>
2024-04-05 16:58:04 +00:00
Faith Ekstrand
11de561395 nak/sm50: Use OpBfe instead of OpBRev for nir_op_find_lsb
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/28000>
2024-03-06 03:20:10 +00:00
Faith Ekstrand
1881d97c27 nak: Implement nir_op_iadd3 on SM70+
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27159>
2024-02-27 21:51:29 -06:00
Karol Herbst
3d4bd73fa3 nak: fix clippy::needless_lifetimes warnings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27234>
2024-01-24 17:46:29 +00:00
Karol Herbst
00a6e2ae4d nak: fix clippy::useless_conversion warnings
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27234>
2024-01-24 17:46:29 +00:00
Benjamin Lee
c3fbd0dcb1 nak: use rro when emitting mufu on SM50
Fixes dEQP-VK.glsl.builtin.precision.*, which was previously failing for
trig functions, exp, and pow.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27203>
2024-01-23 15:43:16 +00:00
Benjamin Lee
f05350899a nak: fix iabs on SM50 with an explicit i2i op
Fixes bug where we were not setting the src iabs modifier when lowering
an iabs op to i2i in the encoder.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27105>
2024-01-19 02:48:04 +00:00
Benjamin Lee
ff84aef116 nak: support predicate sel on SM50
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/27064>
2024-01-16 18:28:22 +00:00
Faith Ekstrand
1f5623c557 nak: Implement 64-bit nir_op_fsign
There is NIR lowering for this but this implementation is more
efficient.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26587>
2023-12-20 02:40:25 +00:00
Faith Ekstrand
8c1daae469 nak: Switch to //-style comments
Some time ago I dropped the C-style `/* */` for `//` which seems to be
more idiomatic in Rust.  Let's get rid of the rest of the C-style ones
and make the codebase consistent.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26716>
2023-12-15 22:38:45 +00:00
Karol Herbst
2701e634c1 nak: fix some sm checks for volta
Signed-off-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26214>
2023-12-12 18:48:11 +00:00
Dave Airlie
10db6948da nvk/nak: fix regression with shf changes on sm70
This commit nak: implement SHL and SHR on SM50 caused a regression on
KHR-GL45.gpu_shader_fp64.* using zink.

This fixes the regression, by setting the wrap fields.

Fixes: 00be041ffc ("nak: implement SHL and SHR on SM50")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26586>
2023-12-08 05:30:09 +00:00
Faith Ekstrand
5bfb46a735 nak: Add dnz bits to OpFMul and OpFFma
Also, while we're here, clean up the from_nir code a bit.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26572>
2023-12-07 20:49:40 +00:00
Faith Ekstrand
e179a90356 nak: Plumb through float controls for fset[p]
Fixes: 1c84c8183c ("nak: Plumb through float controls")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26572>
2023-12-07 20:49:40 +00:00
Faith Ekstrand
29bfdcd7c1 nak: Add an ftz bit to a bunch of float ops
Specifically, OpFAdd, FFma, FMnMx, FMul, and FSwzAdd

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26557>
2023-12-07 16:21:14 +00:00
Faith Ekstrand
6881ff4c99 nak: Drop the fmnmx from Builder
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26557>
2023-12-07 16:21:14 +00:00
Benjamin Lee
ebfd651361 nak: implement IMUL for SM50
IMAD64 does not exist on SM50, so we're using IMUL instead for
nir_op_{i,u}mul_high and nir_op{i,u}mul_2x32_64. Longer-term we may want
to replace this with XMAD for better perf.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:36 +00:00
Benjamin Lee
00be041ffc nak: implement SHL and SHR on SM50
SHF.{L,R} is supported, but it seems to always write 0 to dst when the
shift value is a register. The only case in nak_from_nir that actually
uses the 64-bit shift is nir_op_isign, which has an immediate shift
value.

This also avoids the SHF.I32 issue, since the only usage is now SHF.I64.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:36 +00:00
Benjamin Lee
4b8a8b2a28 nak: use carry register file for IADD2
This allows detecting dependencies between IADD.X and IADD.CC, which is
necessary for SM50 sched and DCE.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:36 +00:00
Benjamin Lee
9d6c487a75 nak: move iadd64 construction to a builder method
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:36 +00:00
Benjamin Lee
8a82f426a2 nak: add IADD instruction for SM50
For now, we're just using this in place of IAdd3x for 64-bit adds. IADD3
with carry flags is supported on SM50, but it works completely
differently from SM75. Longer-term we'll probably want to emit this in
all of the places that we're currently using IADD3.

Also need to hook the carry register up to calc_deps, but for now I'm
just using NAK_DEBUG=serial.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:35 +00:00
Faith Ekstrand
e404877a02 nak: Use OpLop2 and OpPSetP pre-SM70
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:35 +00:00
Faith Ekstrand
36e80caac9 nak: Rename LogicOp to LogicOp3
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:35 +00:00
Benjamin Lee
9af7639e4b nak: make sm available in builders
This is needed for the 'sel' builder method, which should emit different
instrs on SM50 versus SM75.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26114>
2023-12-07 00:36:35 +00:00
Faith Ekstrand
03f1b99f50 nak: Restructure for better module separation
With this commit, NAK now takes on a more Cargo-like structure with
things split better into crates:

 - bitview/
    - lib.rs // Formerly bitview.rs
 - nak/
    - lib.rs // Only pulls stuff into the module
    - api.rs // Formerly nak.rs
    - ...
 - nvfuzz/
    - main.rs // Formerly nvfuzz.rs

Reviewed-by: Karol Herbst <kherbst@redhat.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26546>
2023-12-06 22:41:47 +00:00
Renamed from src/nouveau/compiler/nak_builder.rs (Browse further)