434 Commits

Author SHA1 Message Date
Justin Bogner
c4898f3f22
[HLSL][DirectX] Use a padding type for HLSL buffers. (#167404)
This change drops the use of the "Layout" type and instead uses explicit
padding throughout the compiler to represent types in HLSL buffers.

There are a few parts to this, though it's difficult to split them up as
they're very interdependent:

1. Refactor HLSLBufferLayoutBuilder to allow us to calculate the padding
of arbitrary types.
2. Teach Clang CodeGen to use HLSL specific paths for cbuffers when
generating aggregate copies, array accesses, and structure accesses.
3. Simplify DXILCBufferAccesses such that it directly replaces accesses
with dx.resource.getpointer rather than recalculating the layout.
4. Basic infrastructure for SPIR-V handling, but the implementation
itself will need work in follow ups.

Fixes several issues, including #138996, #144573, and #156084.
Resolves #147352.
2025-11-18 13:38:43 -08:00
Alexander Johnston
ed60cd2563
[HLSL] Implement ddx/ddy_coarse intrinsics (#164831)
Closes https://github.com/llvm/llvm-project/issues/99097
Closes https://github.com/llvm/llvm-project/issues/99100

As ddx and ddy are near identical implementations I've combined them in
this PR. This aims to unblock
https://github.com/llvm/llvm-project/pull/161378

---------

Co-authored-by: Alexander Johnston <alexander.johnston@amd.com>
2025-11-18 16:41:07 +01:00
Steven Perron
834a3cca31
[SPIRV] Handle ptrcast between array and vector types (#166418)
This commit adds support for legalizing pointer casts between array and
vector types within the SPIRV backend.

This is necessary to handle cases where a vector is loaded from or
stored to an array, which can occur with HLSL matrix types.

The following changes are included:
- Added  to load a vector from an array.
- Added  to store a vector to an array.
- Added the  test case to verify the functionality.
2025-11-12 10:27:31 -05:00
Juan Manuel Martinez Caamaño
a276624b2e
[SPIRV][SPIRVPrepareGlobals] Map AMD's dynamic LDS 0-element globals to arrays with UINT32_MAX elements (#166952)
In HIP, dynamic LDS variables are represented using `0-element` global
arrays in the `__shared__` language address-space.

```cpp
  extern __shared__ int LDS[];
```

These are not representable in SPIRV directly.

To represent them, for AMD, we use an array with `UINT32_MAX`-elements.
These are reverse translated to 0-element arrays later in AMD's SPIRV
runtime pipeline (in
[SPIRVReader.cpp](8cb74e264d/lib/SPIRV/SPIRVReader.cpp (L358))).
2025-11-12 10:44:55 +00:00
Juan Manuel Martinez Caamaño
d23d8abf1f
[SPIRV][SPIRVPrepareGlobals] Convert llvm.embedded.module from a 0-element array to a 1-element array (#166950)
When compiling with `-fembed-bitcode-marker`, Clang inserts a
placeholder
for the bitcode. This placeholder is a `[0 x i8]` array, which we cannot
represent in SPIRV.

For AMD flavored SPIRV, we extend the `llvm.embedded.module` global to a
`zeroinitializer [1 x i8]` array.

To achieve this, this patch adds a new pass, `SPIRVPrepareGlobals`, that
we can use to write global variable's _non-trivial-to-lower-IR_ ->
_trivial-to-lower-IR_ mappings.

This is a second attempt at
https://github.com/llvm/llvm-project/pull/162082, but cleaner.

In the translator something similar is done for every 0-element array
since https://github.com/KhronosGroup/SPIRV-LLVM-Translator/pull/2743 .
But I don't think we want to do this mapping for all cases.
2025-11-12 08:47:26 +00:00
Marcos Maronas
2681497d1b
[SPIRV] Allow multiple FuncParamAttr decoration on the same id. (#166782)
According to SPIR-V spec:

> It is invalid to decorate any given id or structure member more than
one time with the same
[decoration](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#Decoration),
unless explicitly allowed below for a specific decoration.

`FuncParamAttr` explicitly allows multiple uses of the decoration on the
same id, so this patch honors it.
2025-11-10 15:24:50 +00:00
Tim Corringham
be84705a9d
[HLSL][SPIRV] Add error test for unpackhalf2x16 (#166969)
Add an error test to check that a suitable error diagnostic is generated
for the use of the GL::unpackhalf2x16 operation in
 invalid contexts.

Fixes #166965

Co-authored-by: Tim Corringham <tcorring@amd.com>
2025-11-10 12:57:19 +00:00
Juan Manuel Martinez Caamaño
57dad86cb3
[SPIRV] Fix failing assertion in SPIRVAsmPrinter (#166909)
With `+SPV_KHR_float_controls2` and when there is a non-int
`OpConstantNull` we
would call `MI.getOperand(1).getImm()` when `MI` was not an `OpTypeInt`
(the
associated test has an `OpTypeArray` zeroinitialized).
Under this conditions an assertion is triggered.

This patch adds the missing condition.
2025-11-10 11:02:53 +01:00
Juan Manuel Martinez Caamaño
d0081aa929
[NFC][SPIRV] Make the zero-length-array.ll test explicit about what is generated (#166910)
This patch doesn't change anything. Just adds more explicit checks to
verify what is generated in this case when an alloca has a zero-sized
array.

I'd expect an `OpRuntimeArray`, but nothing is generated.
2025-11-10 08:38:15 +00:00
Alex Voicu
6ef32188b5
[SPIRV] Add support for bfloat16 atomics via the SPV_INTEL_16bit_atomics extension (#166257)
This enables support for atomic RMW ops (add, sub, min and max to be
precise) with `bfloat16` operands, via the [SPV_INTEL_16bit_atomics
extension](https://github.com/intel/llvm/pull/20009). It's logically a
successor to #166031 (I should've used a stack), but I'm putting it up
for early review.

---------

Co-authored-by: Matt Arsenault <arsenm2@gmail.com>
2025-11-09 17:26:14 +00:00
Alex Voicu
995b0f1883
[SPIRV] Handle inttoptr constant expressions in global initialisers (#166494)
`inttoptr` usage in global initialisers is valid, and rather common when it comes to the machinery around vtables (construction vtables are particularly fond). This was not handled by the BE, even though SPIR-V allows forming `SpecConstantOp`s with the `OpConvertUToPtr` opcode, which is what these would map to. We augment instruction selection to address this.
2025-11-07 01:59:36 +02:00
Aadesh Premkumar
47cf5a1b82
[SPIRV] Support for the extension SPV_ALTERA_blocking_pipes (#138675)
--Added support for the extension SPV_ALTERA_blocking_pipes
--Added test files for the extension SPV_ALTERA_blocking_pipes
2025-11-06 11:59:54 +01:00
Alex Voicu
06ec47055a
[SPIRV] Handle unknown intrinsics (#166284)
This ports rather useful functionality that was already available in the
Translator, and was mostly implemented in the BE. Today, if we encounter
an unknown intrinsic, we pipe it through and hope for the best, which in
practice yields either obtuse ISEL errors, or potentially impossible to
use SPIR-V. With this change, if instructed via a newly added
`--spv-allow-unknown-intrinsics` flag, we emit allowed intrinsics as
calls to extern (import) functions. The test is also mostly lifted from
the Translator.
2025-11-06 10:42:58 +00:00
Tim Corringham
89ec96b8b4
[HLSL] Implement the f16tof32() intrinsic (#165860)
Implement the f16tof32() intrinsic, including DXILand SPIRV codegen, and
associated tests.

Fixes #99112

---------

Co-authored-by: Tim Corringham <tcorring@amd.com>
2025-11-04 17:04:39 +00:00
Alex Voicu
2286118e6f
[SPIRV] Enable bfloat16 arithmetic (#166031)
Enable the `SPV_INTEL_bfloat16_arithmetic` extension, which allows arithmetic, relational and `OpExtInst` instructions to take `bfloat16` arguments. This patch only adds support to arithmetic and relational ops. The extension itself is rather fresh, but `bfloat16` is ubiquitous at this point and not supporting these ops is limiting.
2025-11-04 18:10:26 +02:00
Alex Voicu
2237a18f25
[SPIRV] Enable OpenCL max_work_group_size translation via SPV_INTEL_kernel_attributes (#165891)
This adds BE support for the
[`SPV_INTEL_kernel_attributes`](https://github.khronos.org/SPIRV-Registry/extensions/INTEL/SPV_INTEL_kernel_attributes.html)
extension. The extension is necessary to encode the rather useful
`max_work_group_size` kernel attribute, via `OpExecutionMode
MaxWorkgroupSizeINTEL`, which is the only Execution Mode added by the
extension that this patch adds full processing for. Future patches will
add the other Execution Modes and Capabilities. The test is adapted from
the equivalent Translator test; it depends on #165815.
2025-11-04 14:37:16 +00:00
Alex Voicu
0307147105
[NFC][SPIRV] Add AMDGCN SPIR-V specific defaults to the BE (#165815)
AMDGCN flavoured SPIR-V has slightly different defaults from what the BE
adopts: it assumes all extensions are enabled, and expects nonsemantic
debug info to be generated. Furthermore, it is necessary to encode in
the resulting SPIR-V binary that what was generated was AMDGCN
flavoured, which we do by setting the Generator Version to `UINT16_MAX`
(which matches what we expect to see at reverse translation). We will
register this generator version at
<https://github.com/KhronosGroup/SPIRV-Headers>. This is a preliminary
patch out of a series of patches that are needed for adopting the BE for
AMDGCN flavoured SPIR-V generation.
2025-11-04 12:45:53 +00:00
Alex Voicu
513334faec
[NFC][SPIRV] Fix function type recovery (#165934)
Due to limitations in GISel / IRTranslator, the SPIR-V BE replaces aggregate function args with `i32` placeholders, which are subsequently used to retrieve the original type after IR translation, from metadata. Due to what appears to be an oversight, the current implementation only handles a single mutation, as it does not traverse the metadata, but rather only takes the first operand. This patch addresses that limitation by correctly iterating the metadata.
2025-11-03 19:30:04 +02:00
Steven Perron
9f72fab490
[SPIRV] Fix vector bitcast check in LegalizePointerCast (#164997)
The previous check for vector bitcasts in `loadVectorFromVector` only
compared the number of elements, which is insufficient when the element
types differ. This can lead to incorrect assumptions about the validity
of the cast.

This commit replaces the element count check with a comparison of the
total size of the vectors in bits. This ensures that the bitcast is
only performed between vectors of the same size, preventing potential
miscompilations.

Part of https://github.com/llvm/llvm-project/issues/153091
2025-10-31 10:12:26 -04:00
Sietze Riemersma
bfd4935fa3
[HLSL][DXIL][SPRIV] Added WaveActiveMin intrinsic (#164385)
Adds the WaveActiveMin intrinsic from #99169. I think I did all of the
required things on the checklist:
- [x]  Implement `WaveActiveMin` clang builtin,
- [x]  Link `WaveActiveMin` clang builtin with `hlsl_intrinsics.h`
- [x] Add sema checks for `WaveActiveMin` to
`CheckHLSLBuiltinFunctionCall` in `SemaChecking.cpp`
- [x] Add codegen for `WaveActiveMin` to `EmitHLSLBuiltinExpr` in
`CGBuiltin.cpp`
- [x] Add codegen tests to
`clang/test/CodeGenHLSL/builtins/WaveActiveMin.hlsl`
- [x] Add sema tests to
`clang/test/SemaHLSL/BuiltIns/WaveActiveMin-errors.hlsl`
- [x] Create the `int_dx_WaveActiveMin` intrinsic in
`IntrinsicsDirectX.td`
- [x] Create the `DXILOpMapping` of `int_dx_WaveActiveMin` to `119` in
`DXIL.td`
- [x] Create the `WaveActiveMin.ll` and `WaveActiveMin_errors.ll` tests
in `llvm/test/CodeGen/DirectX/`
- [x] Create the `int_spv_WaveActiveMin` intrinsic in
`IntrinsicsSPIRV.td`
- [x] In SPIRVInstructionSelector.cpp create the `WaveActiveMin`
lowering and map it to `int_spv_WaveActiveMin` in
`SPIRVInstructionSelector::selectIntrinsic`.
- [x] Create SPIR-V backend test case in
`llvm/test/CodeGen/SPIRV/hlsl-intrinsics/WaveActiveMin.ll

But as some of the code has changed and was moved around (E.G.
`CGBuiltin.cpp` -> `CGHLSLBuiltins.cpp`) I mostly followed how
`WaveActiveMax()` is implemented.

I have not been able to run the tests myself as I am unsure which
project runs the correct test. Any guidance on how I can test myself
would be helpful.

Also added some tests to the offload-test-suite
https://github.com/llvm/offload-test-suite/pull/478
2025-10-28 11:01:13 -07:00
Nick Sarnie
98727f6a8f
[SPIRV] Print split 64-bit OpSwitch operands as a single operand for text output (#164886)
In binary form, 64-bit values are split into two 32-bit values as per
the spec. Naturally this works fine with all tools.

However, the text format does not have a formal specification but
SPIR-V-Tools, which we already rely on in the SPIRV workflow (clang
calls `spirv-as` for example), expects the full 64 bit value, but today
we print the two 32-bit values. causing the tool to error and report
that the format is invalid.

The SPIR-V Translator also prints a single 64-bit value for text format.

This case is already handled specifically for `OpConstant`, but
`OpSwitch` was missed. The SPIR-V translator also has special code in
`OpSwitch` handling for this case.

Recombine the two 32-bit operands into a single 64-bit value to print in
`AsmPrinter`. The actual ASM (aka binary form) emission is unchanged.

---------

Signed-off-by: Sarnie, Nick <nick.sarnie@intel.com>
2025-10-27 16:03:46 +00:00
Nikita Kornev
3f47a7be1a
[SPIRV] Upd SPV_KHR_shader_clock extension (#160147)
Add __spirv_ReadClockKHR support
2025-10-23 14:51:54 +02:00
Justin Bogner
0e807a4261
[SPIRV][HLSL] Fix assert with cbuffers through constexpr (#164555)
The comment here pointed out that RAUW would fall over given a
constantexpr, but then proceeded to just do what RAUW does by hand,
which falls over in the same way. Instead, convert constantexprs
involving cbuffer globals to instructions before processing them.

The test update just modifies the existing cbuffer test, since it
implied it was trying to test this exact case anyways.
2025-10-22 10:32:34 -07:00
Lucie Choi
321a419960
[SPIR-V] Fix unit tests for dynamic indexing to add validation step. (#164455)
Add attributes to the unit tests required to pass `spirv-val`.


Addresses https://github.com/llvm/llvm-project/issues/161852
2025-10-21 10:33:24 -07:00
Lucie Choi
23339c4fc6
[SPIR-V] Use OpImageFetch instead of OpImageRead when loading from read-only Buffer resource. (#163626)
Currently, the spir-v validator fails if `OpImageRead` instruction is
used when loading from read-only `Buffer`.
### Unit Test
```hlsl
RWBuffer<uint> rwbuff;
Buffer<uint>  buff;

[numthreads(1,1,1)]
void main() {
    rwbuff[99] = buff[98];
    rwbuff[97] = rwbuff[96];
}
```
This also unblocks adding a test case that adds a special capability
when using a non-uniform index on `Buffer` arrays.
(https://github.com/llvm/llvm-project/pull/162540).

Resolves https://github.com/llvm/llvm-project/issues/162891
2025-10-21 08:55:17 -07:00
Lucie Choi
62f91152fb
[SPIR-V] Add capability for non-uniform indexing for StructuredBuffer types. (#163424)
- Capability `StorageBufferArrayNonUniformIndexing` is required if the
non-uniform index accesses "arrays in the StorageBuffer [storage
class](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#Storage_Class)
or
BufferBlock-[decorated](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#Decoration)
arrays." (e.g. `RWStructuredBuffer`, `StructuredBuffer`)

- Also fix the wrong unit test name: `StructuredBufferNonUniformIdx.ll`
-> `RWBufferNonUniformIdx.ll`

Resolves https://github.com/llvm/llvm-project/issues/162889
Addresses https://github.com/llvm/llvm-project/issues/161852
2025-10-17 17:17:09 -04:00
Lucie Choi
a43c0cf77f
[SPIR-V] Generate SPIR-V instructions when 'enable-maximal-reconvergence' function attribute is set (#163682)
Implement maximal reconvergence in SPIR-V codegen.

Addresses https://github.com/llvm/llvm-project/issues/136930
2025-10-17 13:12:56 +02:00
Subash B
37eda40dd2
[SPIRV] Porting Test from Translator (#152247)
These tests verify SPIR-V code generation for LLVM intrinsics and atomic
operations, ensuring correct translation of fcmp false, llvm.fake.use,
and atomic_compare_exchange.

---------

Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
2025-10-14 23:34:28 -07:00
Ebin-McW
cd2f263a1d
[SPIRV] Porting 4 tests from Translator (#151646)
- Lowering of fcmp false in llvm IR
- Handling duplicate builtins
- Pointer conversion and address space cast
- Dominator ordering

---------

Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
2025-10-14 23:31:40 -07:00
Juan Manuel Martinez Caamaño
782dd178fc
[SPIRV] Do not emit @llvm.compiler.used (#162678)
`@llvm.compiler.used` holds a series of global values and prevents the compiler from optimizing them out.

However, the symbols in the variable can be optimized after compilation
as usual by a linker (notice that `@llvm.used` instead doesn't allow for
the linker to optimize-out the global variables referenced in it).

This was already done for `@llvm.global.annotations`.
2025-10-14 09:04:13 +02:00
Lucie Choi
56c604961e
[SPIR-V] Support nonuniformindex intrsinsic in SPIRV CodeGen. (#162540)
Support `@llvm.spv.resource.nonuniformindex` in SPIRV Codegen. 
- Add `NonUniformEXT` decoration to the registers marked as
`nonuniformindex`, and recursively decorate its child registers (e.g.
Copy, AccessChain, Load) that access such index.
- `OpCapability ShaderNonUniformEXT` is already added in the code.
-
[SPV_EXT_descriptor_indexing](https://github.khronos.org/SPIRV-Registry/extensions/EXT/SPV_EXT_descriptor_indexing.html)
is skipped because it's added to SPIRV Core in 1.5.


## Unit test
- The unit test checks that the register being used in the final
Store/Load/Write instruction is decorated, as required by the spec.
- The implementation follows [DXC](https://godbolt.org/z/zhqGThcaf) in
that it recursively decorates all the child elements until the end.

```hlsl
RWStructuredBuffer<uint4> StructuredOut[64];
RWBuffer<uint> UnStructuredOut[64];

[numthreads(64,1,1)]
void main(uint3 GTID: SV_GroupThreadID) {
    StructuredOut[(NonUniformResourceIndex(GTID.x + 1))][98][0] = 99;

    UnStructuredOut[(NonUniformResourceIndex(GTID.x))][96] = 95;
}

```

Resolves https://github.com/llvm/llvm-project/issues/160231,
https://github.com/llvm/llvm-project/issues/161852.
Verified
[offload-test-suite](cfc37840c8/test/Feature/ResourceArrays/unbounded-array-nuri.test)
started passing for clang.
2025-10-11 15:13:50 -04:00
YixingZhang007
f802acf32d
[SPIR-V] Add SPV_INTEL_predicated_io extension (#161591)
This PR introduces the support for the SPIR-V extension
`SPV_INTEL_predicated_io`. This extension adds predicated load and store
instructions. Predicated load performs load from memory if predicate is
true; otherwise, it uses default_value as a result. Predicated store
performs store of value to memory if predicate is true; otherwise, it
does nothing.

Reference Specification:

https://github.com/intel/llvm/blob/sycl/sycl/doc/design/spirv-extensions/SPV_INTEL_predicated_io.asciidoc
2025-10-08 23:29:01 +02:00
Juan Manuel Martinez Caamaño
fd5bc6033e
[SPIRV][SPIRVLegalizeImplicitBinding] Implement getPassName (#162058) 2025-10-08 10:16:39 +00:00
Juan Manuel Martinez Caamaño
301ecc6da9
[NFC][SPIRV] Add a test documenting the passes in the SPIRV backend (#162057) 2025-10-08 11:39:36 +02:00
Steven Perron
5547c0cff3
[SPIRV] Implement LLVM IR and backend for typed buffer counters (#161425)
This commit implements the backend portion of the typed buffer counter
proposal described in
https://github.com/llvm/wg-hlsl/blob/main/proposals/0023-typed-buffer-counters.md.
This is the second part of the implementation, focusing on the LLVM IR
and SPIR-V backend.

Specifically, this commit implements the "LLVM IR Generation and Backend
Handling"
section of the proposal. This includes:
- Adding the `llvm.spv.resource.counterhandlefromimplicitbinding` and
  `llvm.spv.resource.counterhandlefrombinding` intrinsics.
- Implementing the selection of these intrinsics in the SPIRV backend to
  generate the correct `OpVariable` and `OpDecorate` instructions for
  the counter buffer.
- Handling `IncrementCounter` and `DecrementCounter` via a new
  `llvm.spv.resource.updatecounter` intrinsic, which is lowered to
  `OpAtomicIAdd`.
- Adding a new test file to verify the implementation.

Contributes to https://github.com/llvm/llvm-project/issues/137032

---------

Co-authored-by: Marcos Maronas <marcos.maronas@intel.com>
2025-10-06 06:49:42 -04:00
Lucie Choi
b0ad9c293a
[SPIR-V] Fix asdouble issue in SPIRV codegen to correctly generate OpBitCast instruction. (#161891)
Generate `OpBitCast` instruction for pointer cast operation if the
element type is different.

The HLSL for the unit test is 
```hlsl
StructuredBuffer<uint2> In : register(t0);

RWStructuredBuffer<double2> Out : register(u2);


[numthreads(1,1,1)]
void main() {
  Out[0] = asdouble(In[0], In[1]);
}
```

Resolves https://github.com/llvm/llvm-project/issues/153513
2025-10-03 16:02:06 -04:00
Lucie Choi
2eb6337591
[SPIR-V] Prevent adding duplicate binding instructions for implicit binding (#161299)
Prevent adding duplicate instructions for implicit bindings when they
are from the same resource. The fix is to store and check if the binding
number is already assigned for each `OrderId`.


Resolves https://github.com/llvm/llvm-project/issues/160716
2025-10-02 11:00:56 +00:00
YixingZhang007
ab645f1dff
[SPIRV] Avoid OpQuantizeToF16 in SPIR-V kernel test (#158086)
This PR resolves the current failure in the `integer-casts.ll` SPIR-V
test during CI runs in `llvm-project`.
The failure occurs because the SPIR-V instruction `OpQuantizeToF16`
requires the `Capability::Shader`. However, the function in
`integer-casts.ll` is written as a kernel function and executed in a
kernel environment. Therefore, `Capability::Kernel` is emitted instead
of `Capability::Shader`. To fix this, we remove the `QuantizeToF16` test
from`integer-casts.ll` in this PR.
2025-09-30 16:58:35 +01:00
Marcos Maronas
ebcf025e2e
[SPIR-V] Implement SPV_KHR_float_controls2 (#146941)
Implementation of
[SPV_KHR_float_controls2](https://github.khronos.org/SPIRV-Registry/extensions/KHR/SPV_KHR_float_controls2.html)
extension, and corresponding tests.

Some of the tests make use of `!spirv.ExecutionMode` LLVM named
metadata. This is because some SPIR-V instructions don't have a direct
equivalent in LLVM IR, so the SPIR-V Target uses different LLVM named
metadata to convey the necessary information. Below, you will find an
example from one of the newly added tests:
```
!spirv.ExecutionMode = !{!19, !20, !21, !22, !23, !24, !25, !26, !27}
!19 = !{ptr @k_float_controls_float, i32 6028, float poison, i32 131079}
!20 = !{ptr @k_float_controls_all, i32 6028, float poison, i32 131079}
!21 = !{ptr @k_float_controls_float, i32 31}
!22 = !{ptr @k_float_controls_all, i32 31}
!23 = !{ptr @k_float_controls_float, i32 4461, i32 32}
!24 = !{ptr @k_float_controls_all, i32 4461, i32 16}
!25 = !{ptr @k_float_controls_all, i32 4461, i32 32}
!26 = !{ptr @k_float_controls_all, i32 4461, i32 64}
!27 = !{ptr @k_float_controls_all, i32 4461, i32 128}
```
`!spirv.ExecutionMode` contains a list of metadata nodes, and each of
them specifies the required operands for expressing a particular
`OpExecutionMode` instruction in SPIR-V. For example, `!19 = !{ptr
@k_float_controls_float, i32 6028, float poison, i32 131079}` will be
lowered to `OpExecutionMode [[k_float_controls_float_ID]]
FPFastMathDefault [[float_type_ID]] 131079`.

---------

Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
2025-09-30 16:01:30 +01:00
Ebin-McW
12f42e5ed9
[SPIRV] Frexp intrinsic implementation (#157436)
- Make use of the OpenCL extended instruction frexp.
- Creates a variable and passes it to OpExtInst instruction
2025-09-28 16:51:49 -07:00
Aadesh Premkumar
2b67f5e0b4
[SPIRV] Addition of image_store.ll and signed_arithmetic_overflow.ll (#152289)
--Test for signed arithmetic overflow intrinsics, which is for now
expectedly failing
--Test checking that no duplicate image types are emitted.

---------

Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
2025-09-28 16:34:42 -07:00
Ebin-McW
2cf71fcb97
[SPIRV] Added opencl Pipe builtins (#135335)
- Added opencl Pipe builtins
- Pipe instructions were added in tablegen and lowered in
SPIRVBuiltins.cpp

---------

Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
Co-authored-by: Dmitry Sidorov <dmitry.sidorov@intel.com>
2025-09-28 05:54:59 -07:00
Ebin-McW
0dbc1e2dff
[SPIRV] Added constraint for SPV_INTEL_bindless_image extension (#160249)
Added constraints related to Addressing model as specified in the
specification.
It conforms with the implementation in translator

Same as PR #160089
Solved all issues
2025-09-28 05:52:19 -07:00
Ebin-McW
5d85d54feb
[SPIRV] Add support for the extension SPV_EXT_relaxed_printf_string_address_space (#160245)
Added support for the extension to support more storageclass for printf
strings.
2025-09-28 05:50:15 -07:00
Subash B
0c1acc9814
[SPIRV] Added lowering for the debugtrap intrinsic (#157442)
Mapped llvm.debugtrap intrinsic to OpNop in the SPIR-V backend, since
SPIR-V has no direct equivalent with tests.
2025-09-28 05:45:14 -07:00
Subash B
047ddbf263
[SPIRV] Added support for the constrained comparison intrinsics (#157439)
Added SPIR-V support for constrained floating-point comparison
intrinsics (fcmp, fcmps) with lowering and tests.
2025-09-28 05:42:16 -07:00
Ebin-McW
dcfb904473
[SPIRV] Test file for memmove intrinsic (#152640)
- Added test for checking the lowering of memmove to OpCopyMemorySized
- Modified NoSignedUnsignedWrap.ll by adding a RUN line
2025-09-28 05:20:20 -07:00
Ebin-McW
c058ebda67
[SPIRV] Porting tests to transcoding directory from translator (#151661)
Checks for built-in variables, saturating conversion, half precision
fract, and workgroup variable initialization

---------

Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
2025-09-28 04:49:18 -07:00
Tim Besard
58805dd9ed
[SPIRV] Fix type mismatch assertion in insertvalue. (#143131)
The code was incorrectly converting all `undef` arguments to `i32`,
while the `spv_insertv` intrinsics only expects that for the first
operand, representing the aggregate type.

Fixes https://github.com/llvm/llvm-project/issues/127977

---------

Co-authored-by: Michal Paszkowski <michal@michalpaszkowski.com>
2025-09-28 04:13:41 -07:00
Helena Kotas
663414817b
[SPIRV][NFC] Update issue number in XFAIL test for non-uniform resource index (#160381) 2025-09-25 16:35:14 -07:00