631 Commits

Author SHA1 Message Date
Alex MacLean
e004566547
[NVPTX][AA] Traverse use-def chain to find non-generic addrspace (#106477)
Address space information may be encoded anywhere along the use-def
chain. Take advantage of this by traversing the chain until we find a
non-generic addrspace.
2024-08-29 21:26:58 -07:00
Justin Fargnoli
cdaebf6f0e
[NVPTX] Fix crash caused by ComputePTXValueVTs (#104524)
When [lowering return
values](99a10f1fe8/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp (L3422))
from LLVM IR to SelectionDAG, we check that [the number of values
`SelectionDAG` tells us to return is equal to the number of values that
`ComputePTXValueVTs()` tells us to
return](99a10f1fe8/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp (L3441)).
However, this check can fail on valid IR. For example:

```
define <6 x half> @foo() {
  ret <6 x half> zeroinitializer
}
```

`ComputePTXValueVTs()` tells us to return ***3*** `v2f16` values, while
`SelectionDAG` tells us to return ***6*** `f16` values. Thus, the
compiler will crash.

`ComputePTXValueVTs()` [supports all `half` element vectors with an even
number of
elements](99a10f1fe8/llvm/lib/Target/NVPTX/NVPTXISelLowering.cpp (L213)).
Whereas `SelectionDAG` [only supports power-of-2 sized
vectors](4e078e3797/llvm/lib/CodeGen/TargetLoweringBase.cpp (L1580)).
This is the root of the discrepancy.

Assuming that the developers who added the code to
`ComputePTXValueVTs()` overlooked this, I've restricted
`ComputePTXValueVTs()` to compute the same number of return values as
`SelectionDAG`, instead of extending `SelectionDAG` to support
non-power-of-2 sized vectors.
2024-08-29 18:18:51 -07:00
Denis.G
2d1fba67c5
[NVPTX] Support __usAtomicCAS builtin (#99646)
Supported `__usAtomicCAS` builtin originally defined in
`/usr/local/cuda/inlcude/crt/sm_70_rt.hpp`

---------

Co-authored-by: Denis Gerasimov <Denis.Gerasimov@baikalelectronics.ru>
Co-authored-by: Gonzalo Brito Gadeschi <gonzalob@nvidia.com>
Co-authored-by: Denis.Gerasimov <dengzmm@gmail.com>
2024-08-28 12:01:35 -07:00
Billy Zhu
82113a432c
[LLVM][NVPTX] Remove nonexistent ftz ops (#106100)
According to the PTX
[spec](https://docs.nvidia.com/cuda/parallel-thread-execution/#half-precision-floating-point-instructions-max),
max & min instructions do not support the `ftz` modifier for `bf16` &
`bf16x2` types. This PR removes them from instr info, and the non-ftz
legal versions will be emitted instead.
2024-08-28 09:10:17 -07:00
Jeff Niu
31b4bf938b
[llvm][NVPTX] Fix RAUW bug in NVPTXProxyRegErasure (#105871)
Fix bug introduced in #105730

The bug is in how the batch RAUW is implemented. If we have 

```
%0 = mov %src
%1 = mov %0

use %0
use %1
```

The use of `%1` is rewritten to `%0`, not `%src`. This PR just looks for
a replacement when it maps to the src register, which should
transitively propagate the replacements.
2024-08-24 13:19:44 -04:00
Durgadoss R
d5e9691509
[NVPTX] Add elect.sync Intrinsic (#104780)
This patch adds an NVVM intrinsic and NVPTX codegen for the elect.sync
PTX instruction. Lit tests are
added in elect.ll and verified through ptxas.

PTX ISA reference:

https://docs.nvidia.com/cuda/parallel-thread-execution/index.html#parallel-synchronization-and-communication-instructions-elect-sync

Signed-off-by: Durgadoss R <durgadossr@nvidia.com>
2024-08-20 20:46:05 +05:30
David Majnemer
a9ce181817 [NVPTX] Fix bugs involving maximum/minimum and bf16
We would crash on sufficiently old NV hardware (Volta or so) due to
incorrectly marking certain operations legal.
2024-08-20 05:09:49 +00:00
Sergey Kozub
865952bbbb
[NVPTX] Add conversion intrinsics from/to fp8 types (e4m3, e5m2) (#102969)
PTX ISA 8.1 supports FP8 conversions:

https://docs.nvidia.com/cuda/parallel-thread-execution/#data-movement-and-conversion-instructions-cvt

This PR adds the support for:

- cvt.rn.satfinite{.relu}.f8x2type.f32 d, a, b;
- cvt.rn.satfinite{.relu}.f8x2type.f16x2 d, a;
- cvt.rn.{.relu}.f16x2.f8x2type d, a;

where .f8x2type = { .e4m3x2, .e5m2x2 };
2024-08-19 10:34:22 -07:00
Pradeep Kumar
1ff630d5c3
[LLVM][NVPTX] Add support for brkpt instruction (#104470)
This commit adds NVPTX codegen support for brkpt instruction
(https://docs.nvidia.com/cuda/parallel-thread-execution/#miscellaneous-instructions-brkpt)
with test under CodeGen/NVPTX/brkpt.ll
2024-08-17 10:00:24 +05:30
Alex MacLean
099bf20c3f
[NVPTX] Add idp2a, idp4a intrinsics (#102763)
Add support for `llvm.nvvm.idp2a` and `llvm.nvvm.idp4a` which correspond
directly to `dp2a` and `dp4a` PTX instructions.
2024-08-14 13:31:16 -07:00
Artem Belevich
fe7d2841cf
[NVPTX] unbreak extract_elt lowering (#102688)
LLVM has started using `freeze` instruction, and that unintentionally
broke the lowering of some vector operations in NVPTX.
2024-08-12 10:28:56 -07:00
Hugh Delaney
8a5e179ac1
[NVPTX][NFC] Update tests to use bfloat type (#101493)
Intrinsics are defined with a bfloat type as of commit
250f2bb2c6a9c288faeb821585e9394697c561d8, not i16 and i32 storage types.
As such declarations are no longer needed once the correct types are
used.
2024-08-09 13:59:56 -07:00
Alex MacLean
ccc31278bd
[NVPTX] support switch statement with brx.idx (reland) (#102550)
Add custom lowering for `BR_JT` DAG nodes to the `brx.idx` PTX
instruction ([PTX ISA 9.7.13.4. Control Flow Instructions: brx.idx]
(https://docs.nvidia.com/cuda/parallel-thread-execution/#control-flow-instructions-brx-idx)).
Depending on the heuristics in DAG selection, `switch` statements may
now be lowered using `brx.idx`.

Note: this fixes the previous issue in #102400 by adding the isBarrier
attribute to BRX_END
2024-08-09 11:46:37 -07:00
Hari Limaye
94473f4db6
[IRBuilder] Generate nuw GEPs for struct member accesses (#99538)
Generate nuw GEPs for struct member accesses, as inbounds + non-negative
implies nuw.

Regression tests are updated using update scripts where possible, and by
find + replace where not.
2024-08-09 13:25:04 +01:00
Artem Belevich
2756879000
Revert "[NVPTX] support switch statement with brx.idx" (#102530)
Reverts llvm/llvm-project#102400

Causes LLVM to crash on some tests.
2024-08-08 13:31:10 -07:00
Alex MacLean
ba97697189
[NVPTX] support switch statement with brx.idx (#102400)
Add custom lowering for `BR_JT` DAG nodes to the `brx.idx` PTX
instruction ([PTX ISA 9.7.13.4. Control Flow Instructions: brx.idx]
(https://docs.nvidia.com/cuda/parallel-thread-execution/#control-flow-instructions-brx-idx)).
Depending on the heuristics in DAG selection, `switch` statements may
now be lowered using `brx.idx`
2024-08-08 13:19:26 -07:00
Pradeep Kumar
bfef7ccf03
[LLVM][NVPTX] Add NVPTX codegen support for fence.proxy.tensormap (#100748)
This commit adds LLVM Intrinsics and NVPTX codegen support for
`fence.proxy.tensormap` with lit tests under fence-proxy-tensormap.ll.
Also, added Intrinsics documentation in NVPTXUsage.rst

---------

Co-authored-by: gonzalobg <65027571+gonzalobg@users.noreply.github.com>
2024-08-07 20:25:45 +05:30
gonzalobg
f55abd545d
[NVPTX] Add Volta Atomic SequentiallyConsistent Load and Store Operations (#98551)
This PR Builds on #98022 .
It adds support for Volta's SequentiallyConsistent Load and Store
operations at system scope.
2024-08-06 10:32:51 -07:00
Justin Fargnoli
83d9ed29c1
[NVPTX] Emit NVPTXISD::DYNAMIC_STACKALLOC's chain (#101714)
`LowerDYNAMIC_STACKALLOC()` emits the `dynamic_stackalloc` chain operand
instead of the chain produced by the `NVPTXISD::DYNAMIC_STACKALLOC`. Fix
this behavior and don't produce an unnecessary `ISD::MERGE_VALUES`.
2024-08-05 10:53:33 -07:00
Hugh Delaney
3d1e1d9c2e
[NVPTX][NFC] Remove unneeded declarations in test (#101167)
Only the bf16 declarations are needed, as only they are lowered in
AutoUpgrade.cpp.
f16 and other builtins have LLVM intrinsics already defined.
2024-08-01 13:45:14 +01:00
David Majnemer
6f318d47bf [NVPTX] Make minimum/maximum work on older GPUs
We want to use newer instructions if we are targeting sufficiently new
SM and PTX versions. If we cannot use those newer instructions, let LLVM
synthesize the sequence from more fundamental instructions.
2024-07-31 22:38:19 +00:00
Fabian Ritter
92a06546ab
[LowerMemIntrinsics] Lower llvm.memmove to wide memory accesses (#100122)
So far, the IR-level lowering of llvm.memmove intrinsics generates loops
that copy each byte individually. This can be wasteful for targets that
provide wider memory access operations.

This patch makes the memmove lowering more similar to the lowering of
memcpy with unknown length.
TargetTransformInfo::getMemcpyLoopLoweringType() is queried for an
adequate type for the memory accesses, and if it is wider than a single
byte, the greatest multiple of the type's size that is less than or
equal to the length is copied with corresponding wide memory accesses. A
residual loop with byte-wise accesses (or a sequence of suitable memory
accesses in case the length is statically known) is introduced for the
remaining bytes.

For memmove, this construct is required in two variants: one for copying
forward and one for copying backwards, to handle overlapping memory
ranges. For the backwards case, the residual code still covers the bytes
at the end of the copied region and is therefore executed before the
wide main loop. This implementation choice is based on the assumption
that we are more likely to encounter memory ranges whose start aligns
with the access width than ones whose end does.

In microbenchmarks on gfx1030 (AMDGPU), this change yields speedups up
to 16x for memmoves with variable or large constant lengths.

Part of SWDEV-455845.
2024-07-26 08:43:30 +02:00
gonzalobg
3db78fa1dd
[NVPTX] Add Volta Load/Store Atomics (.relaxed, .acquire, .release) and Volatile (.mmio/.volatile) support (#99709)
Followup to https://github.com/llvm/llvm-project/pull/98022 which broke
support for LLVM `unordered` atomic ordering.

This PR lowers `atomic unordered` to PTX volatile operations to preserve
atomicity, and adds a bunch of tests for this ordering to the NVPTX
backend (we had none).
2024-07-24 11:33:43 -07:00
gonzalobg
3902710a44
[NVPTX] Support fence instruction (#99649) 2024-07-24 10:59:03 -07:00
Matt Davis
404071b059
[SelectionDAG] Preserve volatile undef stores. (#99918)
This patch preserves `undef` SDNodes that are `volatile` qualified.
Previously, these nodes would be discarded. The motivation behind this
change is to adhere to the
[LangRef](https://llvm.org/docs/LangRef.html#volatile-memory-accesses),
even though that doc is mostly in terms of LLVM-IR, it seems reasonable
to imply that the volatile constraints also imply to SDNodes.

> Certain memory accesses, such as
[load](https://llvm.org/docs/LangRef.html#i-load)’s,
[store](https://llvm.org/docs/LangRef.html#i-store)’s, and
[llvm.memcpy](https://llvm.org/docs/LangRef.html#int-memcpy)’s may be
marked volatile. The optimizers must not change the number of volatile
operations or change their order of execution relative to other volatile
operations. The optimizers may change the order of volatile operations
relative to non-volatile operations. This is not Java’s “volatile” and
has no cross-thread synchronization behavior.

Source: https://llvm.org/docs/LangRef.html#volatile-memory-accesses
2024-07-24 08:41:56 -04:00
Joseph Huber
e0649a5dfc
[NVPTX] Fix internal indirect call prototypes not obeying the ABI (#100131)
Summary:
The NVPTX backend optimizes the ABI for functions that are internal,
however, this is not legal for indirect call prototypes. Previously, we
would modify the ABI on an aggregate byval type passed to an indirect
call prototype, which would make PTXAS error. This patch just passes the
function as a nullptr to force strict ABI compliance without
modification in the helper function.

Fixes https://github.com/llvm/llvm-project/issues/100055
2024-07-23 12:54:00 -05:00
Björn Pettersson
2b78303e3f
[DAGCombiner] Freeze maybe poison operands when folding select to logic (#84924)
Just like for regular IR we need to treat SELECT as conditionally
blocking poison in SelectionDAG. So (unless the condition itself is
poison) the result is only poison if the selected true/false value is
poison.
Thus, when doing DAG combines that turn SELECT into arithmetic/logical
operations (e.g. AND/OR) we need to make sure that the new operations
aren't more poisonous. One way to do that is to use FREEZE to make
sure the operands aren't posion.

This patch aims at fixing the kind of miscompiles reported in
  https://github.com/llvm/llvm-project/issues/84653
and
  https://github.com/llvm/llvm-project/issues/85190

Solution is to make sure that we insert FREEZE, if needed to make
the fold sound, when using the foldBoolSelectToLogic and
foldVSelectToSignBitSplatMask DAG combines.
2024-07-22 17:19:46 +02:00
Alex MacLean
4d8e42ea6a
[NVPTX] enforce signed 32 bit type for immediate offset (#99682)
The NVPTX ISA states that an immOff must fit in a signed 32-bit integer
(https://docs.nvidia.com/cuda/parallel-thread-execution/#addresses-as-operands):

> `[reg+immOff]`
>
> a sum of register `reg` containing a byte address plus a constant
> integer byte offset (signed, 32-bit).
> 
> `[var+immOff]`
>
> a sum of address of addressable variable `var` containing a byte
> address plus a constant integer byte offset (signed, 32-bit).

Currently we do not consider this constraint, meaning that in some edge
cases we generate invalid PTX when a value is offset by a very large
immediate.
2024-07-20 08:54:57 -07:00
Jorge Gorbe Moya
49ef0a8dc2
Revert "[NVPTX] Add Volta Load/Store Atomics (.relaxed, .acquire, .release) and Volatile (.mmio/.volatile) support" (#99695)
Reverts llvm/llvm-project#98022
2024-07-19 13:27:40 -07:00
Meredith Julian
b2dcf62c51
[NVPTX] fix emission for i1 load and extload (#99392)
Currently, an illegal 2-byte load from a 1-byte global variable is being
generated. This change instead generates a 1-byte load and zero-extends
it to i16 register. This was always the intended behavior of the
function.

In addition, an i1 ext load of any kind needs to be promoted. A missing
setLoadExtAction for ISD::EXTLOAD was causing an "Unhandled source type"
unreachable due to an illegal i1 ext load during ISelDAGtoDAG (see below
bug).

Bug https://github.com/llvm/llvm-project/issues/98033.
2024-07-18 10:29:24 -07:00
Rajat Bajpai
3a0e015432
[NVPTX] Lower -1/x to neg.f64(rcp.rn.f64) instead of fdiv (#98343)
The NVPTX backend lowers 1/x to rcp.rn.f64 instruction instead of slower
fdiv instruction. However, in the case of -1/x, it uses the slower fdiv
instruction. After this change, -1/x will be lowered into neg.f64
(rcp.rn.f64).
2024-07-16 12:45:21 +05:30
gonzalobg
2da30f8986
[NVPTX] Add Volta Load/Store Atomics (.relaxed, .acquire, .release) and Volatile (.mmio/.volatile) support (#98022)
This PR adds initial support for some of Volta's (sm_70) load/store
atomic and volatile/MMIO operations, hopefully without breaking any
preexisting code. Only relaxed, acquire, and release operations w/
volatile are handled.

This PR does not aim to add support for any of the following:
- syncscope support
- read atomic ops to const, param, grid param
- local memory atomics
- sequentially consistent atomics
- atomicrmw 
- ...
2024-07-15 13:16:45 -07:00
gonzalobg
4797036fdb
[NVPTX] Adds float/double tests to load-store tests. (#96436) 2024-07-15 11:53:53 -07:00
Joseph Huber
486d00eca6
[NVPTX] Implement variadic functions using IR lowering (#96015)
Summary:
This patch implements support for variadic functions for NVPTX targets.
The implementation here mainly follows what was done to implement it for
AMDGPU in https://github.com/llvm/llvm-project/pull/93362.

We change the NVPTX codegen to lower all variadic arguments to functions
by-value. This creates a flattened set of arguments that the IR lowering
pass converts into a struct with the proper alignment.

The behavior of this function was determined by iteratively checking
what the NVCC copmiler generates for its output. See examples like
https://godbolt.org/z/KavfTGY93. I have noted the main methods that
NVIDIA uses to lower variadic functions.

1. All arguments are passed in a pointer to aggregate.
2. The minimum alignment for a plain argument is 4 bytes.
3. Alignment is dictated by the underlying type
4. Structs are flattened and do not have their alignment changed.
5. NVPTX never passes any arguments indirectly, even very large ones.

This patch passes the tests in the `libc` project currently, including
support for `sprintf`.
2024-07-12 17:09:48 -05:00
Joseph Huber
a288d8dad3
[NVPTX] Enable i128 support in the NVPTX backend (#98658)
Summary:
The target information needs to configure that the platform has a
maximum integer size of 64 in order for it to enable i128 support. The
motivation behind this patch is that the i128 libcalls seem to be the
only ones used by the NVPTX backend and it would be ideal to disable
those completely. That would allow LTO to optimize libcalls properly
after https://github.com/llvm/llvm-project/pull/98512.
2024-07-12 13:01:45 -05:00
Joseph Huber
dd3aa5eb70 [NVPTX] Update 32-bit NVPTX tests to use 64-bit
Summary:
These used the now-removed `nvptx` target. Because they used
`ptxas-verify` they would then fail since it's been removed. Update
these to 64-bit.
2024-07-10 16:01:12 -05:00
Chengjunp
cbd3f252e3
[NVPTX] Support inline asm with 128-bit operand in NVPTX backend (#97113)
This change supports the 128-bit operands for inline ptx asm, both input
and output.\
\
The major changes are:

- Tablegen:\
    Define Int128Regs in NVPTXRegisterInfo.td. But this register does
not set as general register type in NVPTX backend so that this change
will not influence the codegen without inline asm.\
    Define three NVPTX intrinsics, IMOV128rr, V2I64toI128 and
I128toV2I64. The first one moves a register, the second one moves two
64-bit registers into one 128-bit register, and the third one just does
the opposite.
- NVPTXISelLowering & NVPTXISelDAGToDAG:\
    Custom lowering CopyToReg and CopyFromReg with 128-bit operands.
CopyToReg deals with the inputs of the inline asm and the CopyFromReg
deals with the outputs.\
    CopyToReg is custom lowered into a V2I64toI128, which takes in the
expanded values(Lo and Hi) of the input, and moves into a 128-bit reg.\
    CopyFromReg is custom lowered by adding a I128toV2I64, which breaks
down the 128-bit outputs of inline asm into the expanded values.
2024-07-01 16:30:33 -07:00
Akshay Deodhar
9fa7c05a1f
[NVPTX] Improved support for grid_constant (#97112)
- Supports escaped grid_constant pointers less conservatively. Casts
uses inside Calls, PtrToInts, Stores where the pointer is a _value
operand_ to generic address space, immediately before the escape, while
keeping other uses in the param address space

- Related to: https://github.com/llvm/llvm-project/pull/96125
2024-06-30 00:50:37 -07:00
Alex MacLean
cb24422b6f
[NVPTX] remove store.params of undef (#96940)
Extend the logic for `NVPTXISD::StoreRetval` to `NVPTXISD::StoreParam`
to remove stores of undef values.
2024-06-28 18:00:51 -07:00
Hugh Delaney
6c2f5d6cde
[NVPTX] Don't use underlying alignment to align param (#96793)
Previously, if a ptr had align N, then the NVPTX lowering was taking
this align N to refer to the alignment of the pointer type itself, as
opposed to the alignment of the memory that it points to.

As such, if a kernel with signature

```
define void @foo(ptr align 4 %_arg_ptr)
```

takes align 4 to be the alignment of the parameter, this would result in
breaking the ld.param into two separate loads like so:

```
	ld.param.u32 	%rd1, [foo_param_0+4];
	shl.b64 	%rd2, %rd1, 32;
	ld.param.u32 	%rd3, [foo_param_0];
	or.b64  	%rd4, %rd2, %rd3;
```

It isn't necessary as far as I can tell from the PTX ISA documents to
specify the alignment of params, nor to break the loading of params into
smaller loads based on their alignment. So this patch changes the
codegen to the better:

```
	ld.param.u64 	%rd1, [foo_param_0];
```
2024-06-27 10:19:05 +01:00
Alex MacLean
2612765faf
[NVPTX] Fold (add (select 0, (mul a, b)), c) -> (select c, (mad a, b, c)) (#96352)
Add folding for `(add (select cond, 0, (mul a, b)), c)` to `(select
cond, c, (mad a, b, c))`. Also, refactor the DAG folding implementation
to separate out the `ADD` and `FADD` folding cases.
2024-06-26 09:01:13 -07:00
Akshay Deodhar
d26451411f
Enforce parameter order in f16 call, flipped call unit tests (#96258) 2024-06-25 14:07:40 -07:00
Alex MacLean
5c9513ac75
[NVPTX] cap param alignment at 128 (max supported by ptx) (#96117)
Cap the alignment to 128 bytes as that is the maximum alignment
supported by PTX. The restriction is mentioned in the parameter passing
section (Note D) of the [PTX Writer's Guide to Interoperability]
(https://docs.nvidia.com/cuda/ptx-writers-guide-to-interoperability/index.html#parameter-passing)

> D. The alignment must be 1, 2, 4, 8, 16, 32, 64, or 128 bytes.
2024-06-25 10:04:45 -07:00
weiwei chen
b0e9b00ce7
[NVPTX] Make nvptx mma instructions convergent. (#96521)
We are running into NVPTX backend generating wrong code for an input:
```
%0 = llvm.nvvm.mma.m?n?k?.row.col.??? (...)
if laneid == 0:
  ret
else:
  store %0
```

The backend reorder the instruction (as an effect of `MachineSink` pass)
to
```
if laneid == 0:
  ret
else:
  %0 = llvm.nvvm.mma.m?n?k?.row.col.??? (...)
  store %0
```

This is incorrect because `mma` is a warp instruction which needs all
threads to sync before performing the operation instead of being guarded
by a specific thread id. It should be similar as the shuffle instruction
`shfl` in terms of warp level sync, and `shfl` is marked as
`isConvergent = true`.

Apply `isConvergent = true` to `mma` instructions.
2024-06-24 22:15:58 -04:00
Akshay Deodhar
687d6fbfac
[NVPTX] Basic support for "grid_constant" (#96125)
- Adds a helper function for checking whether an argument is a
[grid_constant](https://docs.nvidia.com/cuda/nvvm-ir-spec/index.html#supported-properties).
- Adds support for cvta.param using changes from
https://github.com/llvm/llvm-project/pull/95289
- Supports escaped grid_constant pointers conservatively, by casting all
uses to the generic address space with cvta.param.
2024-06-24 14:47:42 -07:00
Justin Fargnoli
049630d0ae
[NFC][NVPTX][test] Update test for fneg half (#95856)
`test_fneg` function uses `fsub half 0.0, %x`. Add a test that uses the
`fneg` instruction directly.
2024-06-17 21:34:42 -07:00
Alex MacLean
435addbf50
[NVPTX] Revamp NVVMIntrRange pass (#94422)
Revamp the NVVMIntrRange pass making the following updates:
- Use range attributes over range metadata. This is what instcombine has
move to for ranges on intrinsics in
https://github.com/llvm/llvm-project/pull/88776 and it seems a bit
cleaner.
- Consider the `!"maxntid{x,y,z}"` and `!"reqntid{x,y,z}"` function
metadata when adding ranges for `tid` srge instrinsics. This can allow
for smaller ranges and more optimization.
- When range attributes are already present, use the intersection of the
old and new range. This complements the metadata change by allowing
ranges to be shrunk when an intrinsic is in a function which is inlined
into a kernel with metadata. While we don't call this more then once
yet, we should consider adding a second call after inlining, once this
has had a chance to soak for a while and no issues have arisen.

I've also re-enabled this pass in the TM, it was disabled years ago due
to "numerical discrepancies" https://reviews.llvm.org/D96166. In our
testing we haven't seen any issues with adding ranges to intrinsics, and
I cannot find any further info about what issues were encountered.
2024-06-06 06:42:46 -07:00
Alex MacLean
661d64bc20
[NVPTX] disable combine-mad test for newer ptxas (#93919) 2024-06-01 09:28:56 -07:00
Alex MacLean
f32ebabc27
[NVPTX] Improve folding to mad with immediate 1 (#93628)
Extend NVPTX DAG combining logic to distribute a mul instruction across
an add of 1 into a mad where possible. In addition, add support for
transposing a mul through a select with an option of 1, if that would
allow further mul folding.
2024-05-29 18:09:21 -07:00
James Y Knight
560c2fd3d4 NVPTX: fix test failures under ptxas-12.0.
(Because ptxas-12 no longer supports 32-bit.)

Fixes c5b11a710e01304908e3f320e40bc9da9f6a8de4 and 8da3a8f550d0b266411b2dc177dff8591ee86cb2.
2024-05-20 23:09:26 -04:00