6994 Commits

Author SHA1 Message Date
Jay Foad
35ebd92d3d
[GlobalISel] Add G_PREFETCH (#74863) 2023-12-11 11:06:50 +00:00
Pierre van Houtryve
dd32d26a37
[AMDGPU] Form V_MAD_U64_U32 from mul24 (#72393)
Fixes SWDEV-421067
2023-12-11 11:38:27 +01:00
Jay Foad
e38c29c2b7 [AMDGPU] Add GFX11 test coverage to integer-mad-patterns.ll 2023-12-08 13:06:03 +00:00
Saiyedul Islam
5c4c199fe3
[AMDGPU][NFC] Improve testing for AMDHSA ABI Version (#74300)
Add tests for COV4 as well as COV5 instead of only testing for the
default version.
2023-12-08 18:09:45 +05:30
Valery Pykhtin
901c5be524
[AMDGPU] Fix GCNUpwardRPTracker: max register pressure on defs. (#74422)
Treat a defined register as fully live "at" the instruction and update maximum pressure accordingly. Fixes #3786.
2023-12-08 11:27:08 +01:00
Pierre van Houtryve
ecd2f56a80
[AMDGPU] Warn if 'amdgpu-waves-per-eu' target occupancy was not met (#74055)
This should make it a bit harder to miss this type of issue. The warning
only shows if amdgpu-waves-per-eu is used.

See SWDEV-434482
2023-12-06 10:46:46 +01:00
Matt Arsenault
08e63dd8fe AMDGPU: Add a MIR test to catch infinite loop
This is derived from one of the regressions reported
after aed1a2217a1da0c9fb7d2c0856302dee25b1d4a1
2023-12-06 15:58:32 +07:00
Pranav Taneja
41507fe595
[GISel] Combine (Scalarize) vector load followed by an element extract. 2023-12-06 11:23:23 +05:30
Nikita Popov
eecb99c5f6 [Tests] Add disjoint flag to some tests (NFC)
These tests rely on SCEV looking recognizing an "or" with no common
bits as an "add". Add the disjoint flag to relevant or instructions
in preparation for switching SCEV to use the flag instead of the
ValueTracking query. The IR with disjoint flag matches what
InstCombine would produce.
2023-12-05 14:09:36 +01:00
Valery Pykhtin
ecf8818380
[AMDGPU] Presubmit test: max register pressure on defs. (#74424)
Upcoming patch #74422.
2023-12-05 13:23:49 +01:00
Ruiling, Song
90681d3a41
AMDGPU: Return legal addressmode correctly for flat scratch (#71494) 2023-12-05 11:22:39 +08:00
Ruiling Song
e31a7581a5 AMDGPU: Pre-commit test to show diff 2023-12-05 11:19:50 +08:00
Ivan Kosarev
2b7191c899
[AMDGPU][True16][GISel] Support v_add_f16 codegen. (#74122) 2023-12-04 14:29:14 +00:00
Jay Foad
110319f20b [AMDGPU] Regenerate some MIR checks 2023-12-04 13:30:00 +00:00
Jay Foad
0e1b3ed0aa [AMDGPU] Tweak non-entry-alloc prefixes to simplify rerunning UTC 2023-12-04 13:29:14 +00:00
Jay Foad
3c01256284 [AMDGPU] Fix back off barrier checks 2023-12-04 13:20:22 +00:00
Valery Pykhtin
a01392cc95
[AMDGPU] Set debug info on CFG annotation instructions. (#73958)
This fixes incorrect source location in ASAN diagnostics for #72247.
2023-12-04 09:56:24 +01:00
Matt Arsenault
db8b85ac58
AMDGPU: Support llvm.exp10 (#65860) 2023-12-02 21:56:35 +07:00
Matt Arsenault
3c86bc0ae9 AMDGPU: Add more tests for rootn libcall handling 2023-12-02 21:53:31 +07:00
Matt Arsenault
5e94080fc7 AMDGPU: Regenerate test checks
Avoids spurious diffs from change in how metadata is checked in
a future commit.
2023-12-02 21:42:05 +07:00
Ramkumar Ramachandra
4d1dc7770a
AMDGPU/load-global-i32: regenerate test using UTC (NFC) (#73962)
Fix the RUN lines so that UTC runs cleanly, and regenerate the test
load-global-i32.ll using utils/update_llc_test_checks.py.
2023-12-01 09:22:13 +00:00
Valery Pykhtin
604c29e934
[AMDGPU] NFC. Add test for debug info on CFG annotation instructions. (#73959) 2023-12-01 09:10:29 +01:00
Jeffrey Byrnes
1b02f594b3
[AMDGPU] Rework dot4 signedness checks (#68757)
Using the known/unknown value of the sign bit, reason about the signedness version of the dot4 instruction.
2023-11-30 13:38:05 -08:00
Piotr Sobczak
73d9f5fda6
[AMDGPU] Add test for GCNRegPressure tracker bug (#73786)
Add a test to document an existing problem in GCNRegPressure tracker.

The upward tracker does not count the registers used (16 of them) in
movrel instruction (for example V_INDIRECT_REG_WRITE_MOVREL_B32_V16).

The downward tracker counts the registers but reports a mismatch:
%0:L0000000000000C00 isn't found in LIS reported set
2023-11-30 16:26:44 +01:00
Pierre van Houtryve
8a66510fa7
[AMDGPU] Don't create mulhi_24 in CGP (#72983)
Instead, create a mul24 with a 64 bit result and let ISel take care of
it.

This allows patterns to simply match mul24 even for 64-bit muls instead of having to match both mul/mulhi and a buildvector/bitconvert/etc.
2023-11-30 08:26:45 +01:00
Ruiling, Song
c1511a65d5
[AMDGPU] Folding imm offset in more cases for scratch access (#70634)
For scratch load/store, our hardware only accept non-negative value in
SGPR/VGPR. Besides the case that we can prove from known bits, we can
also prove that the value in `base` will be non-negative: 1.) When the
ADD for the address calculation has NonUnsignedWrap flag. 2.) When the
immediate offset is already negative.
2023-11-29 12:46:45 +08:00
Stanislav Mekhanoshin
87d884b5c8
[AMDGPU] Fix folding of v2i16/v2f16 splat imms (#72709)
We can use inline constants with packed 16-bit operands, but these
should use op_sel. Currently splat of inlinable constants is considered
legal, which is not really true if we fail to fold it with op_sel and
drop the high half. It may be legal as a literal but not as inline
constant, but then usual literal checks must be performed.

This patch makes these splat literals illegal but adds additional logic
to the operand folding to keep current folds. This logic is somewhat
heavy though.

This has fixed constant bus violation in the fdot2 test.
2023-11-28 09:07:26 -08:00
Jay Foad
0d40831765
[AMDGPU] Allow folding to FMAAK with SGPR and immediate operand on GFX10+ (#72266)
Allow foldImmediate to create instructions like:

  v_fmaak_f32 v0, s0, v0, 0x42000000

This instruction has two "scalar values": s0 and 0x42000000. On GFX10+
this is allowed. This fold was originally implemented before the
compiler supported GFX10, when all ASICs were limited to one scalar
value.
2023-11-28 14:36:37 +00:00
Mariusz Sikora
facead618b
[AMDGPU] PromoteAlloca - bail always if load/store is volatile (#73228)
This change is addressing case where alloca size is the same as
load/store size.
2023-11-28 12:01:35 +01:00
Stanislav Mekhanoshin
82d22a1bb4
[AMDGPU] Fixed folding of inline imm into dot w/o opsel (#73589)
A splat packed constant can be folded as an inline immediate but it
shall use opsel. On gfx940 this code path can be skipped due to HW bug
workaround and then it may be folded w/o opsel which is a bug. Fixed.
2023-11-28 00:50:41 -08:00
Jay Foad
28233b11ac
[AMDGPU] New AMDGPUInsertSingleUseVDST pass (#72388)
Add support for emitting GFX11.5 s_singleuse_vdst instructions. This is
a power saving feature whereby the compiler can annotate VALU
instructions whose results are known to have only a single use, so the
hardware can in some cases avoid writing the result back to VGPR RAM.

To begin with the pass is disabled by default because of one missing
feature: we need an exclusion list of opcodes that never qualify as
single-use producers and/or consumers. A future patch will implement
this and enable the pass by default.

---------

Co-authored-by: Scott Egerton <scott.egerton@amd.com>
2023-11-24 10:23:06 +00:00
Jay Foad
cf1e0c0b07
[AMDGPU] Define new targets gfx1200 and gfx1201 (#73133)
Define target names and ELF numbers for new GFX12 targets gfx1200 and
gfx1201. For now they behave identically to GFX11.
2023-11-23 16:44:05 +00:00
Acim Maravic
376b22a371
[LLVM] Make s_getpc_b64 rematerializable (#71823) 2023-11-23 13:07:12 +01:00
Pierre van Houtryve
d76d8e541d
[AMDGPU][NFC] Update GISel memory-legalizer-atomic-fence test (#72829)
Test needs to be moved to MIR checks and use
stop-after=si-memory-legalizer to avoid being optimized out in a future
patch.
2023-11-23 09:09:05 +01:00
Joe Nash
b072ec5ec6 [AMDGPU] NFC. Run auto-update on a few tests 2023-11-21 13:52:02 -05:00
Jessica Del
f85e7ab035
[AMDGPU] - Add constant folding to s_wqm intrinsic (#72382)
Fold any constant input to the `s_wqm` intrinsic.
2023-11-21 16:36:45 +01:00
Jessica Del
bebf3a9b8a
[AMDGPU] - Add bitreplicate const folding tests (#72649)
Add more test cases for `s_bitreplicate` constant folding.
2023-11-21 09:06:04 +01:00
Valery Pykhtin
c8c81f4dd6
[AMDGPU] Move ballot64 wave32 mode tests to the appropriate place. NFC. (#72959) 2023-11-21 08:29:15 +01:00
bcahoon
28b5054751
[AMDGPU] Fix PromoteAlloca size check of alloca for store (#72528)
When storing a subvector, too many element were written when the
size of the alloca is smaller than the size of the vector store.
This patch checks for the minimum of the alloca vector and the
store vector to determine the number of elements to store.
2023-11-20 07:57:48 -06:00
Valery Pykhtin
57a11b7f75
[AMDGPU] Add live-through register set printing to GCNRegPressurePrinter pass. (#71096)
Add live-through register set printing, assuming live-through register
is in live-in and live-out sets, has no redefinitions but may have uses
in the block.
2023-11-20 13:35:47 +01:00
Rin
befa925aca
[MachineLICM][AArch64] Hoist COPY instructions with other uses in the loop (#71403)
When there is a COPY instruction in the loop with other uses, we want to
hoist the COPY, which in turn leads to the users being hoisted as well.

Co-authored-by David Green : David.Green@arm.com
2023-11-20 10:01:04 +00:00
Diana
61332cb047
[AMDGPU] Emit backend_stack_size PAL metadata (#72509)
For chain functions, PAL uses a `backend_stack_size` metadata item,
which at the moment has the same meaning as `stack_frame_size_in_bytes`.
We emit both for now in order to simplify coordination with PAL.

The new item must be emitted in the `shader_functions` section, just as
the metadata for other module entry functions. For simplicity, we mark
chain functions as module entry functions and emit the same metadata for
all of them.
2023-11-20 10:01:13 +01:00
Stanislav Mekhanoshin
7057f8f676
[AMDGPU] Pre-commit fdot2 test. NFC. (#72622)
This test exposes a bug where we violate constant bus restriction.
2023-11-17 09:32:38 -08:00
Jessica Del
b1e039f3b7
[AMDGPU] - Add constant folding for s_quadmask (#72381)
If the input is a constant we can constant fold the `s_quadmask`
intrinsic.
2023-11-17 15:24:23 +01:00
Valery Pykhtin
667ba7f8f3
[AMDGPU] Fix GCNRewritePartialRegUses pass: vector regclass is selected instead of scalar. (#69957)
For the following testcase:

undef %1.sub1:sgpr_96 = COPY undef %0:sgpr_32
%3:vgpr_32 = V_LSHL_ADD_U32_e64 %1.sub1:sgpr_96, ...

GCNRewritePartialRegUses produced:

%4:vgpr_32 = COPY undef %1:sgpr_32
dead %2:vgpr_32 = V_LSHL_ADD_U32_e64 %4, ...

Register class for %4 is incorrect: there should be sgpr_32 instead of
vgpr_32 because the original %1 had scalar regclass. This patch fixes
that.

Note that GCNRewritePartialRegUses pass isn't enabled by default yet.
2023-11-16 16:56:46 +01:00
Jay Foad
be2388c0d9
[AMDGPU] Prefer v_madak_f32 over v_madmk_f32 to reduce vgpr pressure (#72506)
As explained in the comment in SIInstrInfo::FoldImmediate, if we have a
choice between v_madak_f32 and v_madmk_f32 we should choose the former
so that the literal that is not folded into the instruction can be
materialized in an sgpr instead of a vgpr.
2023-11-16 12:50:26 +00:00
Valery Pykhtin
24c3cd1a51
[AMDGPU] Update rewrite-partial-reg-uses tests. NFC. (#72499) 2023-11-16 11:48:39 +01:00
Jessica Del
af05f9ff06
[AMDGPU] - Add constant folding for s_bitreplicate (#72366)
If the input is a constant, we can constant fold the s_bitreplicate
operation.
2023-11-16 09:08:00 +01:00
Christudasan Devadasan
ce7fd498ed
[AMDGPU] RA inserted scalar instructions can be at the BB top (#72140)
We adjust the insertion point at the BB top for spills/copies during RA
to ensure they are placed after the exec restore instructions required
for the divergent control flow execution. This is, however, required
only for the vector operations. The insertions for scalar registers can
still go to the BB top.
2023-11-16 10:30:03 +05:30
petar-avramovic
95dd0b04d2
AMDGPU/SILowerI1Copies process phi incomings in specific order (#72375)
When merging lane masks, value from block that is always visited first
(PrevReg in buildMergeLaneMasks) needs to exist because we do on-the-fly
constant folding. For PrevReg to exist, basic block that should contain
PrevReg definition must be processed first. Sort the incomings such that
incoming values that dominate other incoming values are processed first.

Sorting of phi incomings makes no changes for phis created by SDAG
because SDAG adds phi incomings as it selects basic blocks in reversed
post order traversal.

This change is required by upcoming lane mask merging implementation
for GlobalISel that leaves phi incomings as they are in IR.
2023-11-15 16:27:51 +01:00