Rhys Perry
a2619b97f5
nir/lower_idiv: add options to use fp32 for 8-bit division lowering
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10081 >
2021-04-12 16:19:46 +00:00
Gert Wollny
46fc8ed432
r600: Enable sb for nir only on specific request
...
SB si known to be buggy and the ultimate aim is to make it go away. To
test workloads with better optimizations it makes sense to be able to
enable SB, but for the NIR backend it should not be enabled together
with NIR the default. Therefore an a specific debug option "nirsb" that
enables NIR with SB.
Fixes: 3b27243b01
r600: Enable sb also for NIR
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/10108 >
2021-04-09 07:32:41 +00:00
Gert Wollny
40fdf1be46
r600/sfn: remove old deref code
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9874 >
2021-03-28 09:27:48 +00:00
Gert Wollny
84f5b15978
r600/sfn: lowered FS output IO
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9874 >
2021-03-28 09:27:48 +00:00
Gert Wollny
3bbc078025
r600/sfn: lower VS IO and drop old deref code
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9874 >
2021-03-28 09:27:48 +00:00
Gert Wollny
195952786b
r600/sfn: Add algebraic lowering for fsin and fcos
...
* fsin and fcos require normalization of the input
* bitfield_insert requires an additional shift of the insert value
v2: drop bitfield_insert lowering code, it is already avaibable as
compiler option (Rhys Perry)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Reviewed-by: Kristian H. Kristensen <hoegsberg@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9452 >
2021-03-22 15:19:46 +01:00
Gert Wollny
4459fc224b
r600/sfn: lower idiv, imod, etc in nir
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9584 >
2021-03-14 13:28:44 +00:00
Jason Ekstrand
117668b811
nir: Make nir_ssa_def_rewrite_uses take an SSA value
...
This commit replaces the new_src parameter of nir_ssa_def_rewrite_uses()
with an SSA def, removes nir_ssa_def_rewrite_uses_ssa(), and rewrites
all the users as needed.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com >
Acked-by: Alyssa Rosenzweig <alyssa@collabora.com >
Acked-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9383 >
2021-03-08 16:59:55 +00:00
Gert Wollny
e148d5ec99
r600/sfn: lower intrinsic_load_tess_coord to driver version
...
Fixes
KHR-GL45.tessellation_shader.tessellation_shader_tessellation.TCS_TES
KHR-GL45.tessellation_shader.tessellation_shader_tessellation.TES
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9373 >
2021-03-04 09:14:03 +00:00
Gert Wollny
c427ed7ffe
r600/sfn: Lower FS inputs to temps late and, and lower interpolate at
...
This fixes FS shaders where a var is loaded with two different
interpolators.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9330 >
2021-03-02 18:46:17 +01:00
Gert Wollny
488c93ac11
r600/sfn: use lowering pass for cube textures
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9302 >
2021-02-26 15:00:44 +00:00
Gert Wollny
dc51b75714
r600/sfn: use lower bool to int32 and lower int_tg4 only on shader clone
...
These changes should not be visible to shader variants that may go through
the optimization another time.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9302 >
2021-02-26 15:00:44 +00:00
Gert Wollny
ee27ca68f8
r600/sfn: Base instr lowering class on nir_lower_instruction code
...
Now that the lowering pass has been update there is no need to
duplicate the code to scan the shader.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9167 >
2021-02-22 20:43:02 +00:00
Gert Wollny
9fa48c0207
r600/sfn: update shader array info
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563 >
2021-01-20 12:12:07 +00:00
Gert Wollny
7717c1090a
r600/nir: pass array info to r600_shader for sb
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563 >
2021-01-20 12:12:07 +00:00
Gert Wollny
4f88668f4a
r600/nir: clone shader before first query to shader key
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8563 >
2021-01-20 12:12:07 +00:00
Gert Wollny
0bed972619
r600/sfn: tie in 64 lowering code
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7824 >
2021-01-12 19:29:40 +00:00
Gert Wollny
de4e4980d8
r600/sfn: C++ lower-instruct implementation
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7824 >
2021-01-12 19:29:40 +00:00
Gert Wollny
166657a736
r600/sfn: Fix a few warnings in release builds
...
[1083/1142] Compiling C++ object src/gallium/drivers/r600/libr600.a.p/sfn_sfn_nir_lower_fs_out_to_vector.cpp.o
../src/gallium/drivers/r600/sfn/sfn_nir_lower_fs_out_to_vector.cpp: In member function ‘nir_ssa_def* r600::NirLowerFSOutToVector::create_combined_vector(nir_builder*, nir_ssa_def**, int, int)’:
../src/gallium/drivers/r600/sfn/sfn_nir_lower_fs_out_to_vector.cpp:442:48: warning: ‘op’ may be used uninitialized in this function [-Wmaybe-uninitialized]
nir_alu_instr * instr = nir_alu_instr_create(b->shader, op);
| ~~~~~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~
[1092/1142] Compiling C++ object src/gallium/drivers/r600/libr600.a.p/sfn_sfn_nir.cpp.o
../src/gallium/drivers/r600/sfn/sfn_nir.cpp: In function ‘int r600_shader_from_nir(r600_context*, r600_pipe_shader*, r600_shader_key*)’:
../src/gallium/drivers/r600/sfn/sfn_nir.cpp:859:24: warning: unused variable ‘func’ [-Wunused-variable]
859 | const nir_function *func = reinterpret_cast<const nir_function *>(exec_list_get_head_const(&sel->nir->functions));
| ^~~~
[1118/1142] Compiling C++ object src/gallium/drivers/r600/libr600.a.p/sfn_sfn_shader_base.cpp.o
../src/gallium/drivers/r600/sfn/sfn_shader_base.cpp: In member function ‘void r600::ShaderFromNirProcessor::add_array_deref(nir_deref_instr*)’:
../src/gallium/drivers/r600/sfn/sfn_shader_base.cpp:300:18: warning: unused variable ‘var’ [-Wunused-variable]
300 | nir_variable *var = nir_deref_instr_get_variable(instr);
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7820 >
2020-11-28 12:32:25 +01:00
Gert Wollny
517b698661
r600/sfn: lower all IO in one pass
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
45f17702db
r600/sfn: simplify IO lowering and fix TESS IO lowering
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
efcb7b7050
r600/sfn: lower GS IO
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
eafa9bff80
r600/sfn: Lower tess-eval IO
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
7421f9d95b
r600/sfn: lower VS output IO
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
3b6c17e296
r600/sfn: lower IO for FS inputs and handle interpolation accordingly
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
e9babb853d
r600/sfn: Add lowering pass to convert load_interpolated to load for POS
...
the values are loaded directly from a register and the specification of
parycentrics is only in the way.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7715 >
2020-11-27 10:37:15 +00:00
Gert Wollny
335c48ab33
r600/sfn: lower bool to int32 only after common optimizations
...
Fixes: f79b7fcf7c
r600/sfn: use 32 bit bools
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7714 >
2020-11-22 15:38:08 +00:00
Vinson Lee
bbd21c4038
r600/sfn: Initialize ShaderFromNir members in constructor.
...
Fix defect reported by Coverity Scan.
Uninitialized scalar field (UNINIT_CTOR)
uninit_member: Non-static class member chip_class is not initialized in
this constructor nor in any functions that it calls.
uninit_member: Non-static class member scratch_size is not initialized
in this constructor nor in any functions that it calls.
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7648 >
2020-11-20 00:48:53 +00:00
Vinson Lee
c1b675bdd5
r600/sfn: Fix typos.
...
Signed-off-by: Vinson Lee <vlee@freedesktop.org >
Reviewed-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7649 >
2020-11-19 16:39:36 -08:00
Eric Anholt
d867e7c974
nir: Add an option to not lower source mods for f64/u64/i64.
...
TGSI can't handle them, but we want to use this pass for nir-to-tgsi.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3395 >
2020-10-20 08:54:06 -07:00
Gert Wollny
f79b7fcf7c
r600/sfn: use 32 bit bools
...
That's closer to what the driver actually does.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7142 >
2020-10-16 12:03:12 +00:00
Gert Wollny
92a4d45bee
r600/sfn: use cacheless op for coherent image write
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7142 >
2020-10-16 12:03:12 +00:00
Gert Wollny
31e42fb780
r600/sfn: replace hand-backed literal check by NIR function
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6879 >
2020-09-28 18:16:29 +00:00
Gert Wollny
972dd730d9
r600/sfn: lower to scalar for some optimizations and vectortize later
...
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6879 >
2020-09-28 18:16:28 +00:00
Gert Wollny
0a59530d0d
r600/sfn: Sort the outputs of the FS according to data index
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6814 >
2020-09-22 14:32:45 +00:00
Gert Wollny
1625a9b9ae
r600/sfn: remove a useless if-condition
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6814 >
2020-09-22 14:32:45 +00:00
Gert Wollny
4f4e90bfbb
r600/sfn: run late algebraic optimizations
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6814 >
2020-09-22 14:32:45 +00:00
Gert Wollny
18e9781714
r600/sfn: Use load_ubo_vec4 lowering pass
...
This replaces the lowering pass to align UBO loads at 16 byte
boundaries.
v2: use nir functions to query constants in ubo_vec4 (Eric)
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6743 >
2020-09-17 10:11:11 +00:00
Gert Wollny
daaa71924a
r600/sfn: clone shader before lowering to registers and src/dest modifiers
...
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6706 >
2020-09-16 08:30:41 +00:00
Eric Anholt
f25e169897
nir/opt_vectorize: Add a callback for filtering of vectorizing.
...
For NIR-to-TGSI, we don't want to revectorize 64-bit ops that we split to
scalar beyond vec2 width. We even have some ops that we would rather
retain as scalar due to TGSI opcodes being scalar, or having more unusual
requirements.
This could be used to do the vectorize_vec2_16bit filtering, but that
shader compiler option is also used in algebraic so leave it in place for
now.
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6567 >
2020-09-02 09:59:17 -07:00
Karol Herbst
70cbddc4a7
nir: use enum operator helper for nir_variable_mode and nir_metadata
...
those are used quite a bit
Signed-off-by: Karol Herbst <kherbst@redhat.com >
Reviewed-by: Jason Ekstrand <jason@jlekstrand.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6520 >
2020-09-01 17:45:08 +00:00
Gert Wollny
834a61df4e
r600/sfn: Force a minimum of 4 GPRs, it seems to fix atomics
...
This fixes spec@arb_compute_shader@execution@atomic-counter on
HD 5450
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6025 >
2020-08-09 13:45:36 +00:00
Gert Wollny
56dedf052f
r600/sfn: add r600 specific lowering pass for atomics and use it
...
v2: rebase to use global variable lists
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6025 >
2020-08-09 13:45:34 +00:00
Gert Wollny
df2acf8e26
r600/sfn: Sort uniforms by binding and offset
...
This is required to get atomics right.
v2: rebase to use global variable lists
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6025 >
2020-08-09 13:45:33 +00:00
Jason Ekstrand
d70fff99c5
nir: Use a single list for all shader variables
...
Instead of having separate lists of variables, roughly sorted by mode,
use a single list for all shader-level NIR variables. This makes a few
list walks a bit longer here and there but list walks aren't a very
common thing in NIR at all. On the other hand, it makes a lot of things
like validation, printing, etc. way simpler. Also, there are a number
of cases where we move variables from inputs/outputs to globals and this
makes it way easier because we no longer have to move them between
lists. We only have to deal with that if moving them from the shader to
a nir_function_impl.
Reviewed-by: Rob Clark <robdclark@chromium.org >
Reviewed-By: Mike Blumenkrantz <michael.blumenkrantz@gmail.com >
Reviewed-by: Vasily Khoruzhick <anarsoul@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966 >
2020-07-29 17:38:58 +00:00
Jason Ekstrand
2956d53400
nir: Add nir_foreach_shader_in/out_variable helpers
...
Reviewed-by: Jose Maria Casanova Crespo <jmcasanova@igalia.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5966 >
2020-07-29 17:38:57 +00:00
Gert Wollny
033968a94e
r600/sfn: Add lowering pass for shared IO
...
Lower shared load and store to use the r600 specific intrinsics.
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5575 >
2020-06-22 12:01:17 +00:00
Gert Wollny
b303540c48
r600/sfn: lower image derefs
...
v2: Signal lowering image derefs by using the CAP
Signed-off-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5206 >
2020-06-19 06:58:07 +00:00
Timothy Arceri
04dbf709ed
nir: add callback to nir_remove_dead_variables()
...
This allows us to do API specific checks before removing variable
without filling nir_remove_dead_variables() with API specific code.
In the following patches we will use this to support the removal
of dead uniforms in GLSL.
Reviewed-by: Kenneth Graunke <kenneth@whitecape.org >
Reviewed-by: Eric Anholt <eric@anholt.net >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4797 >
2020-06-03 02:22:23 +00:00
Dave Airlie
ff9c95421a
r600/sfn: plumb the chip class into the instruction emission
...
In order to emit the correct instruction sequences for cayman
we need this info.
Reviewed-by: Gert Wollny <gert.wollny@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5084 >
2020-05-18 21:56:29 +00:00