Marek Olšák
1e178f7a37
ac: make ac_shader_abi::inputs an array instead of a pointer
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12570 >
2021-09-07 17:51:41 +00:00
Marek Olšák
6df5f268db
ac: remove needless parameters from ac_shader_abi::emit_outputs
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12570 >
2021-09-07 17:51:41 +00:00
Timur Kristóf
346eb08a3d
radeonsi: Change GS vertex offset arguments to use gs_vtx_offset array.
...
This makes RadeonSI behave like RADV, and hence makes it possible to
use the NIR based ESGS I/O lowering and NGG lowering.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12511 >
2021-08-26 05:20:15 +00:00
Marek Olšák
dd9801a918
radeonsi: rename SI_SGPR_RW_BUFFERS to SI_SGPR_INTERNAL_BINDINGS
...
They are just internal buffers and images.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8653 >
2021-01-22 16:45:30 +00:00
Marek Olšák
b6b6d1ff3c
radeonsi: fix hang caused by for loop with exec=0 in LS and ES
...
LLVM expects that exec != 0 when entering loops and generates this code
that becomes an infinite loop if exec == 0:
BB5_1:
vcc_lo = (inverted terminating condition)
s_and_b32 vcc_lo, exec_lo, vcc_lo
s_cbranch_vccnz BB5_3 // jump if vcc != 0 (break statement)
// ... loop body ...
s_branch BB5_1
BB5_3:
For non-monolithic VS before TCS, VS before GS, and TES before GS,
we set exec = (thread enabledmask), which sets 0 for HS-only and GS-only
waves, causing the infinite loop condition above.
Fix it as follows:
- set exec = ~0 at the beginning
- wrap the whole shader (LS and ES) in a conditional block, so that HS-only
and GS-only waves jump over it and never enter such a loop
The TES before GS hang can be reproduced by gfxbench:
testfw_app --gfx egl -w 1920 -h 1080 --gl_api gles -t gl_tess
Fixes: 68d6d097f1
- radeonsi/gfx9: add GFX9 and VEGA10 enums
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/8344 >
2021-01-06 23:28:01 -05:00
Rob Clark
790144e65a
util+treewide: container_of() cleanup
...
Replace mesa's slightly different container_of() with one more aligned
to the linux kernel's version which takes a type as the 2nd param. This
avoids warnings like:
freedreno_context.c:396:44: warning: variable 'batch' is uninitialized when used within its own initialization [-Wuninitialized]
At the same time, we can add additional build-time type-checking asserts
Signed-off-by: Rob Clark <robdclark@chromium.org >
Acked-by: Erik Faye-Lund <erik.faye-lund@collabora.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7941 >
2020-12-10 16:48:36 +00:00
Marek Olšák
3b67c6451f
ac: unify shader arguments that are duplicated
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com >
Reviewed-by: Connor Abbott <cwabbott0@gmail.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939 >
2020-12-09 20:13:25 +00:00
Marek Olšák
248268fb7d
radeonsi: move si_llvm_compiler_shader and deps into si_shader_llvm.c
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939 >
2020-12-09 20:13:25 +00:00
Marek Olšák
8cd1522622
radeonsi: move si_build_main_function into si_shader_llvm.c
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939 >
2020-12-09 20:13:25 +00:00
Marek Olšák
273be1686e
radeonsi: move si_create_function into si_shader_llvm.c
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7939 >
2020-12-09 20:13:24 +00:00
Marek Olšák
61fe66a2e4
radeonsi: pass VS->TCS IO via VGPRs if VS and TCS have the same thread count
...
It can only be done if a TCS input is accessed without indirect indexing and
with gl_InvocationID as the vertex index, and the number of VS and TCS threads
is the same.
This eliminates LDS stores and loads for VS->TCS IO, reducing shader lifetime
and LDS traffic.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7623 >
2020-11-23 02:22:21 +00:00
Marek Olšák
1190808eca
radeonsi: if VS and TCS have the same number of threads, merge the conditonals
...
Instead of:
if (VS) {
VS;
}
if (TCS) {
TCS;
}
Do this if the number of threads is the same in VS and TCS:
exec = enabled_threads;
VS;
TCS;
Skipping declare_vb_descriptor_input_sgprs is needed to match the VS return
values.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7623 >
2020-11-23 02:22:21 +00:00
Marek Olšák
9b5b5cbc53
radeonsi: adjust tess SGPRs to allow fully occupied 3 HS waves of triangles
...
With triangles and 3 HS waves, 3 lanes were unoccupied. Adjust the SGPR
encoding to allow 1 more triangle to fit there.
Some of the fields are not large enough, but they weren't large enough
before either.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7623 >
2020-11-23 02:22:20 +00:00
Marek Olšák
1de0bf0a56
radeonsi: remove indirection when loading position at the end for NGG culling
...
If we store the position into LDS after we know the new thread ID,
we don't need to remember the old thread ID.
The culling code only needs W, X/W, Y/W, so we have to keep those.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7172 >
2020-10-17 01:58:19 +00:00
Marek Olšák
bad7b38aa1
radeonsi: remove dead variable postponed_kill
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/7031 >
2020-10-06 15:59:08 +00:00
Marek Olšák
9fc9615274
ac,radeonsi: lower 64-bit IO to 32 bits and remove all dead code
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6623 >
2020-09-08 17:11:07 +00:00
Marek Olšák
6ecb8b6899
radeonsi: replace TGSI_SEMANTIC with VARYING_SLOT and FRAG_RESULT
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6340 >
2020-09-02 23:03:00 -04:00
Marek Olšák
62aaa0d0b7
radeonsi: remove unused si_shader_context::type
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6340 >
2020-09-02 23:03:00 -04:00
Marek Olšák
a90d1df820
radeonsi: change PIPE_SHADER to MESA_SHADER (si_compile_llvm)
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6340 >
2020-09-02 23:03:00 -04:00
Marek Olšák
b4b323c81e
radeonsi: change PIPE_SHADER to MESA_SHADER (si_shader_context::type)
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6340 >
2020-09-02 23:03:00 -04:00
Marek Olšák
97456e847e
radeonsi: add a common function for getting the size of gs_ngg_scratch
...
The next commit will use it.
Fixes: a23802bcb9
- ac,radeonsi: start adding support for gfx10.3
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6137 >
2020-08-07 11:22:22 -04:00
Marek Olšák
8fff9beb44
radeonsi: fix NGG culling for Wave64
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5524 >
2020-06-30 10:56:41 +00:00
Pierre-Eric Pelloux-Prayer
ce7692fc19
radeonsi: add return value to gfx10_ngg_calculate_subgroup_info
...
gfx10_ngg_calculate_subgroup_info uses assert to detect invalid configuration,
but if asserts are disabled it will continue its execution.
This commits adds a boolean return value to let the caller know that something
went wrong and that the results mustn't be used.
Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/3103
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5401 >
2020-06-10 09:33:48 +02:00
Marek Olšák
85a6bcca61
radeonsi: pass at most 3 images and/or shader buffers via user SGPRs for compute
...
This should slightly decrease shader lifetime.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/5209 >
2020-06-02 20:47:49 +00:00
Pierre-Eric Pelloux-Prayer
d7008fe46a
radeonsi: switch to 3-spaces style
...
Generated automatically using clang-format and the following config:
AlignAfterOpenBracket: true
AlignConsecutiveMacros: true
AllowAllArgumentsOnNextLine: false
AllowShortCaseLabelsOnASingleLine: false
AllowShortFunctionsOnASingleLine: false
AlwaysBreakAfterReturnType: None
BasedOnStyle: LLVM
BraceWrapping:
AfterControlStatement: false
AfterEnum: true
AfterFunction: true
AfterStruct: false
BeforeElse: false
SplitEmptyFunction: true
BinPackArguments: true
BinPackParameters: true
BreakBeforeBraces: Custom
ColumnLimit: 100
ContinuationIndentWidth: 3
Cpp11BracedListStyle: false
Cpp11BracedListStyle: true
ForEachMacros:
- LIST_FOR_EACH_ENTRY
- LIST_FOR_EACH_ENTRY_SAFE
- util_dynarray_foreach
- nir_foreach_variable
- nir_foreach_variable_safe
- nir_foreach_register
- nir_foreach_register_safe
- nir_foreach_use
- nir_foreach_use_safe
- nir_foreach_if_use
- nir_foreach_if_use_safe
- nir_foreach_def
- nir_foreach_def_safe
- nir_foreach_phi_src
- nir_foreach_phi_src_safe
- nir_foreach_parallel_copy_entry
- nir_foreach_instr
- nir_foreach_instr_reverse
- nir_foreach_instr_safe
- nir_foreach_instr_reverse_safe
- nir_foreach_function
- nir_foreach_block
- nir_foreach_block_safe
- nir_foreach_block_reverse
- nir_foreach_block_reverse_safe
- nir_foreach_block_in_cf_node
IncludeBlocks: Regroup
IncludeCategories:
- Regex: '<[[:alnum:].]+>'
Priority: 2
- Regex: '.*'
Priority: 1
IndentWidth: 3
PenaltyBreakBeforeFirstCallParameter: 1
PenaltyExcessCharacter: 100
SpaceAfterCStyleCast: false
SpaceBeforeCpp11BracedList: false
SpaceBeforeCtorInitializerColon: false
SpacesInContainerLiterals: false
Reviewed-by: Marek Olšák <marek.olsak@amd.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4319 >
2020-03-30 11:05:52 +00:00
Marek Olšák
1a0890dcf3
radeonsi: change prototypes of si_is_multi_part_shader & si_is_merged_shader
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
be772182e0
radeonsi: make si_compile_llvm return bool
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
bd19d144a1
radeonsi: move more LLVM functions into si_shader_llvm.c
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
1c73d598eb
radeonsi: minor cleanup in si_shader_internal.h
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
ab33ba987a
radeonsi: move si_shader_llvm_build.c content into si_shader_llvm.c
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
cd5b99c541
radeonsi: move VS shader code into si_shader_llvm_vs.c
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
d1c42e2c6a
radeonsi: move non-LLVM code out of si_shader_llvm.c
...
There was also some redundant code in si_shader_nir.c
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
594f085cfa
radeonsi: use ctx->ac. for types and integer constants
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3421 >
2020-01-23 19:10:21 +00:00
Marek Olšák
8db00a51f8
radeonsi/gfx10: implement NGG culling for 4x wave32 subgroups
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-20 16:16:11 -05:00
Marek Olšák
a966729c84
radeonsi/gfx10: export primitives at the beginning of VS/TES
...
This decreases VGPR usage and will allow us to merge some IF blocks
in shaders.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-20 16:16:11 -05:00
Marek Olšák
5a0fcf11f0
radeonsi/gfx10: move s_sendmsg gs_alloc_req to the beginning of shaders
...
This will allow us to merge some IF blocks in shaders.
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-20 16:16:11 -05:00
Marek Olšák
c4daf2b485
radeonsi: merge si_compile_llvm and si_llvm_compile functions
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
2020-01-15 21:54:55 +00:00
Marek Olšák
68586bdd21
radeonsi: remove useless #includes
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
2020-01-15 21:54:55 +00:00
Marek Olšák
30b14ba67e
radeonsi: move code for shader resources into si_shader_llvm_resources.c
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
2020-01-15 21:54:55 +00:00
Marek Olšák
da2c12af4b
radeonsi: move geometry shader code into si_shader_llvm_gs.c
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
2020-01-15 21:54:55 +00:00
Marek Olšák
57bd73e229
radeonsi: remove llvm_type_is_64bit
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
2020-01-15 21:54:55 +00:00
Marek Olšák
194449a405
radeonsi: move tessellation shader code into si_shader_llvm_tess.c
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3399 >
2020-01-15 21:54:55 +00:00
Marek Olšák
cf65c6f0d2
radeonsi: move VS_STATE.LS_OUT_PATCH_SIZE a few bits higher to make space there
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-15 15:06:31 -05:00
Marek Olšák
34ef0c5083
radeonsi: make si_insert_input_* functions non-static
...
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-15 15:06:29 -05:00
Marek Olšák
8832a88434
radeonsi: move PS LLVM code into si_shader_llvm_ps.c
...
This is an attempt to clean up si_shader.c.
v2: don't move code that is not specific to LLVM
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com > (v1)
2020-01-14 18:46:07 -05:00
Marek Olšák
9b60b3ce93
radeonsi: remove always constant ballot_mask_bits from si_llvm_context_init
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
2020-01-14 18:46:07 -05:00
Marek Olšák
37916a66b1
radeonsi: fold si_create_function into si_llvm_create_func
...
Reviewed-by: Timothy Arceri <tarceri@itsqueeze.com >
2020-01-14 18:46:07 -05:00
Marek Olšák
363b4027fc
radeonsi: put up to 5 VBO descriptors into user SGPRs
...
gfx6-8: 1 VBO descriptor in user SGPRs
gfx9-10: 5 VBO descriptors in user SGPRs
We no longer pull up to 5 VBO descriptors from GTT when SDMA is disabled.
Totals from affected shaders:
SGPRS: 1110528 -> 1170528 (5.40 %)
VGPRS: 952896 -> 951936 (-0.10 %)
Spilled SGPRs: 83 -> 61 (-26.51 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Private memory VGPRs: 0 -> 0 (0.00 %)
Scratch size: 0 -> 0 (0.00 %) dwords per thread
Code Size: 23766296 -> 22843920 (-3.88 %) bytes
LDS: 0 -> 0 (0.00 %) blocks
Max Waves: 179344 -> 179344 (0.00 %)
Wait states: 0 -> 0 (0.00 %)
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-13 15:57:07 -05:00
Marek Olšák
420fe1e7f9
radeonsi: remove TGSI
...
Acked-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
2020-01-06 15:57:20 -05:00
Marek Olšák
43f05e0421
radeonsi/gfx10: fix ngg_get_ordered_id
...
This could have caused issues with NGG streamout.
Reviewed-by: Pierre-Eric Pelloux-Prayer <pierre-eric.pelloux-prayer@amd.com >
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3095 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3095 >
2019-12-16 20:06:07 +00:00