6499 Commits

Author SHA1 Message Date
Matt Arsenault
c3b27c236d RegAllocGreedy: Fix assert with remarks on unassigned subregisters
This tried to query the physical subregister on virtual registers
if they were left unassigned.
2023-06-25 19:26:25 -04:00
Matt Arsenault
9f274939db AMDGPU: Handle the easy parts of strict fptrunc
f64->f16 is hard. The expansion is all integer but we need
to raise exceptions. Also doesn't handle the illegal f16 targets.
2023-06-25 19:26:25 -04:00
Matt Arsenault
3d409e55a1 AMDGPU: Handle constrained fpext 2023-06-25 19:26:25 -04:00
Amaury Séchet
391a95fdb1 [NFC] Autogenerate CodeGen/AMDGPU/combine-reg-or-const.ll 2023-06-25 22:56:42 +00:00
Teresa Johnson
200cc952a2 [LTO][GlobalDCE] Use pass parameter instead of module flag for LTO phase
D63932 added a module flag to indicate that we are executing the regular
LTO post merge pipeline, so that GlobalDCE could perform more aggressive
optimization for Dead Virtual Function Elimination. This caused issues
trying to reuse bitcode that had already been through the LTO pipeline
(see context in D139816).

Instead support this by passing down a parameter flag to the
GlobalDCEPass constructor, which is the more usual way for indicating
this information.

Most test changes are to remove incidental uses of this flag. Of the 2
real uses, llvm/test/LTO/ARM/lto-linking-metadata.ll is now obsolete and
removed in this patch, and the virtual-functions-visibility-post-lto.ll
test is updated to use the regular LTO default pipeline where this
parameter is set to true.

Differential Revision: https://reviews.llvm.org/D153655
2023-06-23 17:05:07 -07:00
Matt Arsenault
2449931b01 AMDGPU: Don't use old form of fneg in some tests 2023-06-23 09:11:06 -04:00
Matt Arsenault
c56e4a8c42 AMDGPU: Modernize exp codegen tests
Find and replace on the new log tests (plus <3 x half> which was
missing). Apparently exp10 never worked.
2023-06-23 09:11:06 -04:00
Matt Arsenault
89ccfa1b39 AMDGPU: Use correct lowering for llvm.log2.f32
We previously directly codegened to v_log_f32, which is broken for
denormals. The lowering isn't complicated, you simply need to scale
denormal inputs and adjust the result. Note log and log10 are still
not accurate enough, and will be fixed separately.
2023-06-23 08:37:37 -04:00
Ivan Kosarev
813f6a495b [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 12.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152905
2023-06-23 13:33:06 +01:00
Matt Arsenault
089f652f17 AMDGPU: Add more log vector tests 2023-06-23 08:28:42 -04:00
Ivan Kosarev
9435942447 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 10.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152903
2023-06-23 12:24:52 +01:00
Jay Foad
c85923190f [AMDGPU] Regenerate some checks 2023-06-22 13:28:30 +01:00
Pravin Jagtap
597fb7fb46 [AMDGPU] Switch to the new cl option amdgpu-atomic-optimizer-strategy.
Atomic optimizer is turned on by default through D152649. This patch
removes the usage of old command line option amdgpu-atomic-optimizations
and transfer the responsibility to `amdgpu-atomic-optimizer-strategy`.

We can safely remove old option when LLPC remove its all usage.

Reviewed By: foad, arsenm, #amdgpu, cdevadas

Differential Revision: https://reviews.llvm.org/D153007
2023-06-22 07:06:42 -04:00
Ivan Kosarev
e67288fa5a [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 14.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152907
2023-06-22 10:52:16 +01:00
Ivan Kosarev
3bf0041dd9 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 13.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152906
2023-06-22 10:42:59 +01:00
Matt Arsenault
92ee60b66f AMDGPU: Drop and upgrade llvm.amdgcn.atomic.inc/dec to atomicrmw 2023-06-21 21:20:26 -04:00
Matt Arsenault
80e2c26dfd RegisterCoalescer: Fix name of pass
I finally snapped and fixed this inconsistency.
2023-06-21 10:30:43 -04:00
Jay Foad
0b8a2eaf62 [AMDGPU] Add some positive tests for merging S_LOAD instructions 2023-06-21 13:56:03 +01:00
Pravin Jagtap
8e1e871e2f [AMDGPU] Preserve dom-tree analysis in atomic optimizer.
AMDGPUAtomicOptimizer updates the dominator tree whenever
it modified the control flow. Therefore preserving the
analysis similar to legacy PM.

Reviewed By: arsenm, yassingh, #amdgpu

Differential Revision: https://reviews.llvm.org/D153349
2023-06-21 08:02:43 -04:00
Matt Arsenault
e777da468c AMDGPU: Delete old AMDGPUPropagateAttributes pass
The optimizing, non-broken features have all been moved to
AMDGPUAttributor. The only remaining piece of functionality was the
broken propagation of the wavesize features. This was fundamentally
broken and a hack for device library linking. It doesn't matter when
the device libraries are correctly linked and internalized.

In case of linked-as-normal-bitcode (as comgr still does), we're
reliant on the global subtarget anyway. If we can get away without
forcing target-cpu, we should just as well be able to get away without
propagating target-features.
2023-06-20 13:05:45 -04:00
Matt Arsenault
7dcb9c0f09 InlineSpiller: Consider copy bundles when looking for snippet copies
This was looking for full copies produced by SplitKit, but SplitKit
introduces copy bundles if not all lanes are live. The scan for uses
needs to look at bundles, not individual instructions.

This is a prerequisite to avoiding some redundant spills due to
subregisters which will help avoid an allocation failure in a future
patch.
2023-06-20 12:26:27 -04:00
Pravin Jagtap
699addeff0 [AMDGPU] Use verify<domtree> instead of intra-pass asserts.
Verifying dominator tree is expensive using intra-pass
asserts. Asserts added during D147408 are
increasing the build time of libc significantly. This change
does the verification after the atomic optimizer pass
and should fix the regression reported in D153232.

Reviewed By: arsenm, #amdgpu

Differential Revision: https://reviews.llvm.org/D153261
2023-06-20 09:52:58 -04:00
Ivan Kosarev
2d3e6c4402 [AMDGPU] Drop GFX11 runs for dagcombine-fma-fmad.ll and fma.f16.ll.
They cause failures on the llvm-clang-x86_64-expensive-checks-debian
buildbot.

This partially reverts
D153269 [AMDGPU][GFX11] Add test coverage for FMA instructions.
2023-06-20 11:32:44 +01:00
Ivan Kosarev
dec42ffa28 [AMDGPU][GFX11] Add test coverage for FMA instructions.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D153269
2023-06-20 10:50:03 +01:00
Jay Foad
4b6d41cd1d [AMDGPU] Do not release VGPRs if there may be pending scratch stores
Differential Revision: https://reviews.llvm.org/D153295
2023-06-19 21:12:43 +01:00
Florian Hahn
dae5cd73cb
Recommit "[LSR] Consider post-inc form when creating extends/truncates."
This reverts the revert commit 1797ab36efc9c90c921cd725831f8c3f6a7125a2.

The recommitted version now checks the PostIncLoopSets for all fixups
and returns nullptr if the result doesn't match for all fixups.
2023-06-19 17:57:06 +01:00
Jeffrey Byrnes
ac2d6df2d6 [AMDGPU] Add basic support for extended i8 perm matching
Differential Revision: https://reviews.llvm.org/D142782

Change-Id: Ibb95224f7885839e8b77a705f487f10b47a258a6
2023-06-19 09:53:25 -07:00
Jay Foad
eb7491769a [AMDGPU] Reimplement the GFX11 early release VGPRs optimization
Implement this optimization in SIInsertWaitcnts, where we already have
information about whether there might be outstanding VMEM store
instructions. This has the following advantages:
- Correctly handles atomics-with-return.
- Correctly handles call instructions.
- Should be faster because it does not require running a separate pass.

Differential Revision: https://reviews.llvm.org/D153279
2023-06-19 17:12:54 +01:00
Matt Arsenault
7c8958118c AMDGPU: Remove amdgpu-waves-per-eu support in old attribute pass
AMDGPUAttributor now handles this attribute with value merging, so
delete the old approach which could only apply this to functions which
did not set it, or cloned the function.
2023-06-19 11:50:50 -04:00
Florian Hahn
1797ab36ef
Revert "[LSR] Consider post-inc form when creating extends/truncates."
This reverts commit abfeda5af329b5889db709ff74506e20e0b569e9.
and fe19036e1266d2a90b44725c82b898134906e4c3.

The added assertion triggers during clang bootstrap builds. Revert while
I investigate.
2023-06-17 17:58:41 +01:00
Florian Hahn
fe19036e12
[AMDGPU] Update test after abfeda5af329b58. 2023-06-17 10:15:15 +01:00
Jay Foad
01b512882d [AMDGPU] Generate checks for load-constant tests
Differential Revision: https://reviews.llvm.org/D153139
2023-06-17 06:47:15 +01:00
Matt Arsenault
d9333e360a Revert "AMDGPU: Drop and auto-upgrade llvm.amdgcn.ldexp to llvm.ldexp"
This reverts commit 1159c670d40e3ef302264c681fe7e0268a550874.

Accidentally pushed wrong patch
2023-06-16 18:13:07 -04:00
Matt Arsenault
1159c670d4 AMDGPU: Drop and auto-upgrade llvm.amdgcn.ldexp to llvm.ldexp 2023-06-16 18:06:27 -04:00
Matt Arsenault
b9c6d9e6c3 AMDGPU: Propagate amdgpu-waves-per-eu with attributor
This will do a value range merging down the callgraph, unlike the
current pass which can only propagate values to undecorated functions
from a kernel.

This one is a bit weird due to the interaction with the implied range
from amdgpu-flat-workgroup-size. At the default group range of 1,1024,
the minimum implied bounds is 4 so this ends up introducing the
attribute on undecorated functions. We could probably simplify this by
ignoring it and propagating the raw values. The subtarget interaction
and the interaction with amdgpu-flat-workgroup-size only really clamp
invalid values (plus the lower bound doesn't seem to do anything as
far as I can tell anyway).
2023-06-16 15:04:08 -04:00
Jay Foad
2124759528 [AMDGPU] Regenerate llvm.amdgcn.s.buffer.load checks 2023-06-16 15:21:17 +01:00
Jay Foad
d065adcb48 [AMDGPU] Regenerate a few checks 2023-06-16 11:39:03 +01:00
Ivan Kosarev
41717fdee1 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 15.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152908
2023-06-16 10:31:35 +01:00
Ivan Kosarev
7a12fbc05f [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 11.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152904
2023-06-16 10:08:32 +01:00
Stanislav Mekhanoshin
4b111dd798 [AMDGPU] Fix VOPD dependency checks during combine
Check superreg/subreg defs of an instruction when checking for
dependencies. This may cause some regressions, but better be
safe than sorry. Changed tests are affected because of the
implicit-defs of the superregs.

Differential Revision: https://reviews.llvm.org/D152943
2023-06-15 11:16:33 -07:00
Matt Arsenault
3928e2d43f AMDGPU: Add baseline test for propagating amdgpu-waves-per-eu 2023-06-15 13:16:25 -04:00
Matt Arsenault
e3547bc21b AMDGPU: Assume llvm.amdgcn.exp2 and log are canonicalizing
This was partially handled for log in SelectionDAG and both were
missed for GlobalISel.
2023-06-15 09:55:15 -04:00
Matt Arsenault
f8cc1b6400 AMDGPU: Delete some stray / dead check prefixes 2023-06-15 09:35:12 -04:00
Matt Arsenault
28f3edd2be AMDGPU: Add llvm.amdgcn.exp2 intrinsic
Provide direct access to v_exp_f32 and v_exp_f16, so we can start
correctly lowering the generic exp intrinsics.

Unfortunately have to break from the usual naming convention of
matching the instruction name and stripping the v_ prefix. exp is
already taken by the export intrinsic. On the clang builtin side, we
have a choice of maintaining the convention to the instruction name,
or following the intrinsic name.
2023-06-15 07:00:07 -04:00
Ivan Kosarev
9aa026e9ff [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 9.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152902
2023-06-15 11:02:08 +01:00
Ivan Kosarev
9792c804f6 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 8.
Reviewed By: Joe_Nash

Differential Revision: https://reviews.llvm.org/D152809
2023-06-15 10:47:04 +01:00
Ivan Kosarev
7680951ac8 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 7.
Reviewed By: Joe_Nash

Differential Revision: https://reviews.llvm.org/D152808
2023-06-15 10:40:58 +01:00
Ivan Kosarev
c2887096f3 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 6.
Reviewed By: Joe_Nash

Differential Revision: https://reviews.llvm.org/D152807
2023-06-15 10:39:31 +01:00
Ivan Kosarev
79c8301478 [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 5.
Reviewed By: Joe_Nash

Differential Revision: https://reviews.llvm.org/D152805
2023-06-15 10:28:16 +01:00
Ivan Kosarev
980d2b337e [AMDGPU][GFX11] Add test coverage for 16-bit conversions, part 4.
Reviewed By: arsenm

Differential Revision: https://reviews.llvm.org/D152717
2023-06-15 10:26:41 +01:00