Daniel Schürmann
36e0d2f39b
aco: coalesce v_mad's accumulator with definition's affinities
...
Totals from affected shaders:
Code Size: 8922676 -> 8915192 (-0.08 %) bytes
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
d000d76f13
aco: use upper part of gap in register file if it is beneficial for striding
...
Totals from affected shaders:
SGPRS: 1717288 -> 1716984 (-0.02 %)
VGPRS: 1305924 -> 1304904 (-0.08 %)
Code Size: 138508892 -> 138420144 (-0.06 %) bytes
Max Waves: 115726 -> 115735 (0.01 %)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
d666d83be2
aco: try to always find a register with stride for even sizes
...
Totals from affected shaders:
SGPRS: 1162400 -> 1162400 (0.00 %)
VGPRS: 947364 -> 946960 (-0.04 %)
Code Size: 98399300 -> 98399004 (-0.00 %) bytes
Max Waves: 74665 -> 74682 (0.02 %)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
5a3c1f4f0b
aco: stop get_reg_simple after reaching max_used_gpr
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
2796cb4c24
aco: refactor get_reg_simple() to return early on exact matches
...
in the best fit algorithm
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
6792e134f3
aco: don't create vector affinities for operands which are not killed or are duplicates
...
Totals from affected shaders:
SGPRS: 825184 -> 825184 (0.00 %)
VGPRS: 697640 -> 697240 (-0.06 %)
Code Size: 79244104 -> 79201072 (-0.05 %) bytes
Max Waves: 42388 -> 42386 (-0.00 %)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
edc2b57ac1
aco: allocate full register for subdword definitions if HW doesn't support it
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
97a870cf88
aco: move attempt to find strided register into get_reg_simple()
...
This simplifies code and helps some shaders
Totals from affected shaders:
Code Size: 51227172 -> 51202216 (-0.05 %) bytes
Max Waves: 19955 -> 19948 (-0.04 %)
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
c7f97f110c
aco: use DefInfo in more places to simplify RA
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
734f86db6b
aco: create and use DefInfo struct in RA
...
for maintaining all information necessary to find a register.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
5b2f628da3
aco: create pseudo dummy instruction in RA to be used for live-range splits
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
d9f7d1d5cb
aco: refactor get_reg() to also handle affinities
...
This simplifies definition handling and
helps a few shaders
Totals from affected shaders:
Code Size: 659540 -> 659376 (-0.02 %) bytes
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:23 +00:00
Daniel Schürmann
7c8f4ebca9
aco: refactor get_reg() to take Temp instead of RegClass
...
This patch also moves get_reg_specified() and
get_reg_vec() before get_reg() to make use of it later.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:22 +00:00
Daniel Schürmann
0a9ed98178
aco: simplify operand handling in RA
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4573 >
2020-04-22 18:23:22 +00:00
Rhys Perry
fbd2be3f5d
aco: clear moved operands in get_reg_create_vector()
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4507 >
2020-04-14 10:49:12 +00:00
Rhys Perry
52cc1f8237
aco: improve p_create_vector RA for sub-dword operands
...
These's still improvements needed for sub-dword definitions, but that's
not as simple.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4507 >
2020-04-14 10:49:12 +00:00
Daniel Schürmann
38622de2ec
aco: make some reg_file helpers private and fix their uses
...
Fixes various subdword RA issues
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4492 >
2020-04-10 07:19:27 +00:00
Daniel Schürmann
d22e2b3bd0
aco: RA - move all std::function objects into proper functions
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
5351fee56a
aco: move all needed helper containers to ra_ctx
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
2ae27b96ef
aco: change live_out variables to std::unordered_set
...
Improves performance of live_var_analysis for larger shaders
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
acc10a7e51
aco: change some std::map to std::unordered_map in register_allocation
...
This improves compile times slightly for larger shaders
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
69b6069dd2
aco: refactor try_remove_trivial_phi() in RA
...
Minor refactoring to avoid some pointer chasing.
This patch also changes the live_out argument to be
passed by reference to avoid an unnecessary copy.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
09850e0a94
aco: during RA only insert into renames table if a variable got renamed
...
This improves the speed of register allocation.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
48a74b6815
aco: replace assignment hashmap by std::vector in register allocation
...
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
ba482c2e5f
aco: improve register assignment when live-range splits are necessary
...
When finding a good place for a register, we can ignore
killed operands.
Reviewed-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4130 >
2020-04-09 15:08:57 +00:00
Daniel Schürmann
0680b258f4
aco: align subdword registers during RA when necessary
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Daniel Schürmann
031edbc4a5
aco: adapt register allocation for subdword registers
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Daniel Schürmann
2c74fc98b8
aco: create helper function to collect variables from register area
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Daniel Schürmann
aca2bbf975
aco: add notion of subdword registers to register allocator
...
To not having to split the register file into single bytes,
we maintain a map with registers which contain subdword variables.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Daniel Schürmann
90811554da
aco: remove unnecessary reg_file.fill() operation in get_reg_create_vector()
...
No pipelinedb changes
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Daniel Schürmann
7de003473c
aco: fix Temp and assignment of renamed operands during RA
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Rhys Perry
34424b81df
aco: make PhysReg in units of bytes
...
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Reviewed-By: Timur Kristóf <timur.kristof@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/4002 >
2020-04-03 23:13:15 +01:00
Rhys Perry
1872759f55
aco: add a late kill flag
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3914 >
2020-03-16 16:09:02 +00:00
Albert Astals Cid
760fe44e8c
aco: pass vars by const &
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3935 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/3935 >
2020-03-02 13:18:49 +00:00
Rhys Perry
fe5c5507bd
aco: add some helpers for filling/testing register ranges
...
We do this a lot
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3768 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3768 >
2020-02-19 12:23:50 +00:00
Rhys Perry
43497e30e2
aco: add RegisterFile
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3768 >
2020-02-19 12:23:50 +00:00
Daniel Schürmann
3b323d6601
aco: fix image_atomic_cmp_swap
...
Fixes: 71440ba0f5 ('aco: reorder VMEM operands in ACO IR')
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3652 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3652 >
2020-01-31 16:51:46 +00:00
Daniel Schürmann
99d032f3cd
aco: fix register allocation with multiple live-range splits
...
This patch fixes register allocation if multiple live-range splits
occur to the same variable within one instruction.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3602 >
2020-01-29 18:45:23 +00:00
Daniel Schürmann
71440ba0f5
aco: reorder VMEM operands in ACO IR
...
For all VMEM instructions, the resource constant is now
in operands[0]. For MIMG instructions, the sampler shares
operands[1] with write data in case this instruction writes memory.
Moving the VADDR to be the last operand for MIMG is the first step to
support Navi NSA encoding.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3602 >
2020-01-29 18:45:23 +00:00
Rhys Perry
15a1cc00d3
aco: fix off-by-one error when initializing sgpr_live_in
...
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Closes: https://gitlab.freedesktop.org/mesa/mesa/issues/2394
Fixes: 93c8ebfa78 ('aco: Initial commit of independent AMD compiler')
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Tested-by: Marge Bot <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3511 >
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3511 >
2020-01-22 17:23:30 +00:00
Daniel Schürmann
427e5eeb02
aco: handle phi affinities transitively through parallelcopies
...
This can coalesce most unnecessarily inserted parallelcopies
from lowering to CSSA.
v2: refactor loop a bit to make it more efficient and readable.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3385 >
2020-01-16 16:01:59 +01:00
Rhys Perry
f9405ceb8a
aco: don't move literal to reg when making an instruction VOP3 on GFX10
...
pipeline-db (Navi):
Totals from affected shaders:
SGPRS: 163398 -> 163398 (0.00 %)
VGPRS: 143820 -> 143820 (0.00 %)
Spilled SGPRs: 0 -> 0 (0.00 %)
Spilled VGPRs: 0 -> 0 (0.00 %)
Code Size: 13065744 -> 13044308 (-0.16 %) bytes
Max Waves: 18921 -> 18921 (0.00 %)
Instructions: 2514644 -> 2509285 (-0.21 %)
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/2883 >
2020-01-14 12:56:28 +00:00
Daniel Schürmann
ffb4790279
aco: compact various Instruction classes
...
No pipelinedb changes.
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/merge_requests/3332 >
2020-01-10 17:49:18 +00:00
Daniel Schürmann
6a586a6006
aco: split read/writelane opcode into VOP2/VOP3 version for SI/CI
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
2019-12-07 11:23:11 +01:00
Timur Kristóf
e0bcefc3a0
aco/wave32: Use lane mask regclass for exec/vcc.
...
Currently all usages of exec and vcc are hardcoded to use s2 regclass.
This commit makes it possible to use s1 in wave32 mode and
s2 in wave64 mode.
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
2019-12-04 10:36:01 +00:00
Daniel Schürmann
8861a82be7
aco: don't split live-ranges of linear VGPRs
...
Fixes: 93c8ebfa78 'aco: Initial commit of independent AMD compiler'
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
2019-11-29 21:54:27 +01:00
Daniel Schürmann
b6f5085dfe
aco: preserve kill flag on moved operands during RA
...
Fixes: 93c8ebfa78 aco: Initial commit of independent AMD compiler
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
2019-11-12 15:59:48 +00:00
Daniel Schürmann
a2a6880743
aco: fix invalid access on Pseudo_instructions
...
Fixes: 93c8ebfa78 aco: Initial commit of independent AMD compiler
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
2019-11-12 15:59:48 +00:00
Daniel Schürmann
8023dcd71e
aco: fix live-range splits of phis
...
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
2019-10-30 19:48:33 +00:00
Timur Kristóf
c52ebbcea4
aco: Introduce vgpr_limit to keep track of available VGPRs.
...
Signed-off-by: Timur Kristóf <timur.kristof@gmail.com>
Reviewed-by: Daniel Schürmann <daniel@schuermann.dev>
2019-10-28 23:52:50 +00:00