12495 Commits

Author SHA1 Message Date
Longsheng Mou
3e223e3a20
[mlir][vector] Fix out-of-bounds access (#126734)
This PR fixes an out-of-bounds bug that occurs when there are no overlap
dimensions between the `sizes` and source of
`vector.extract_strided_slice`, causing access to `sizes` to go out of
bounds. Fixes #126196.
2025-02-13 09:17:43 +08:00
Uday Bondhugula
8421ad7f45
[MLIR][Affine] Fix sibling fusion - missing check (#126626)
Fix sibling fusion for slice maximality check. Producer-consumer fusion
had this check but not sibling fusion. Sibling fusion shouldn't be
performed if the slice isn't "maximal" (i.e., if it isn't the whole of
the source).


Fixes: https://github.com/llvm/llvm-project/issues/48703
2025-02-13 06:21:03 +05:30
Uday Bondhugula
4078b11daa
[MLIR][Affine] Fix fusion crash for non-int/fp memref elt types (#126829)
Fix assumption on memref elt types being int or float during private
memref creation in affine fusion.

Fixes: https://github.com/llvm/llvm-project/issues/121020
2025-02-13 05:27:48 +05:30
Amir Bishara
51c847d8f3
[mlir][tosa]-Edit the verifier of tosa constShapeOp (#126962)
Add verification for rank 1 for the elements' attribute of the tosa
const_shape operation.
2025-02-12 15:06:00 -08:00
Nikhil Kalra
65ed4fa57e
[mlir] Python: Parse ModuleOp from file path (#126572)
For extremely large models, it may be inefficient to load the model into
memory in Python prior to passing it to the MLIR C APIs for
deserialization. This change adds an API to parse a ModuleOp directly
from a file path.

Re-lands
[4e14b8a](4e14b8afb4).
2025-02-12 14:02:41 -08:00
Max191
67cde37f3c
[mlir] Match before rewrite in BubbleUpPackOpThroughGenericOp (#126946)
The BubbleUpPackOpThroughGenericOp pattern had some unsafe rewrites
happening before matching was fully complete, which causes the pattern
rewriter to fail to converge. This PR fixes the bug by moving all
matching logic to before the rewrite logic.

Signed-off-by: Max Dawkins <max.dawkins@gmail.com>
2025-02-12 10:44:24 -08:00
Ivan Butygin
e167c31dc9
Reland [mlir] ArithToLLVM: fix memref bitcast lowering (#125148) (#126939)
Reland https://github.com/llvm/llvm-project/pull/125148

Limiting vector pattern caused issues with `select` of complex lowering,
which wasn't caught as it was missing lit tests. Keep the pattern as is
for now and instead set a higher benefit to `IdentityBitcastLowering` so
it will always run before the vector pattern.
2025-02-12 20:32:13 +03:00
Alex MacLean
a282b6c486
[NVPTX] Convert scalar function nvvm.annotations to attributes (#125908)
Replace some more nvvm.annotations with function attributes,
auto-upgrading the annotations as needed. These new attributes will be
more idiomatic and compile-time efficient than the annotations.

- !"maxclusterrank" / !"cluster_max_blocks" -> "nvvm.maxclusterrank"
- !"minctasm" -> "nvvm.minctasm"
- !"maxnreg" -> "nvvm.maxnreg"
2025-02-12 07:33:22 -08:00
Frank Schlimbach
0fd50ec9a3
[MLIR][mesh] Mesh fixes (#124724)
A collection of fixes to the mesh dialect
- allow constants in sharding propagation/spmdization
- fixes to tensor replication (e.g. 0d tensors)
- improved canonicalization
- sharding propagation incorrectly generated too many ShardOps
New operation `mesh.GetShardOp` enables exchanging sharding information
(like on function boundaries)
2025-02-12 12:44:48 +01:00
Ivan Butygin
0e779ad499
Revert "[mlir] ArithToLLVM: fix memref bitcast lowering" (#126895)
Reverts llvm/llvm-project#125148

bot failures
2025-02-12 14:34:16 +03:00
Ivan Butygin
79010e2e4d
[mlir] ArithToLLVM: fix memref bitcast lowering (#125148)
`arith.bitcast` is allowed on memrefs and such code can actually be
generated by IREE `ConvertBf16ArithToF32Pass`.
`LLVM::detail::vectorOneToOneRewrite` doesn't properly check its types
and will generate bitcast between structs which is illegal.

With the opaque pointers this is a no-op operation for memref so we can
just add type check in `LLVM::detail::vectorOneToOneRewrite` and add a
separate pattern which removes op if converted types are the same.
2025-02-12 14:19:13 +03:00
Nikita Popov
c03325cead
[MLIR][LLVMIR] Use TargetFolder when creating globals (#126745)
The LLVM dialect lowers globals using IRBuilder, relying on it creating
constant expressions where possible. As we remove support for more
constant expressions (per
https://discourse.llvm.org/t/rfc-remove-most-constant-expressions/63179),
this can cause issues for cases where the constant expression is no
longer supported, and the operation cannot be constant folded without
DataLayout being available. In particular, I ran into this issue with
flang and the removal of mul constant expressions.

Address this by using TargetFolder when creating globals, which will
perform DL-aware constant folding. I think it would make sense to also
do this in general, but I'm starting with globals where not doing this
can result in translation failures.

Ideally, globals with these problematic expressions would never be
generated in the first place, but there has been little movement on
fixing this (https://github.com/llvm/llvm-project/issues/96047).
2025-02-12 10:14:00 +01:00
Hongtao Yu
4a63ff4330
Revert "[mlir] Enable LICM for ops with only read side effects in scf.for" (#126840)
Reverts llvm/llvm-project#120302
2025-02-11 20:07:21 -08:00
lonely eagle
82cbb02cbc
[mlir][vector][NFC] Fix typos in tests (#126662)
[mlir][vector] Fix typos in tests (nfc)

Fix typos in `{insert|extract}_scalar_from_vec_2d_f32_dynamic_idxs_compile_time_constant` - the intention was to use `f32` rather than `i32`.
2025-02-12 10:05:32 +08:00
donald chen
f15a6c99fa
[mlir] [DataFlow] Fix bug in int-range-analysis (#126708)
When querying the lower bound and upper bound of loop to update the
value range of a loop iteration variable, the program point to depend on
should be the block corresponding to the iteration variable rather than
the loop operation.
2025-02-12 09:58:56 +08:00
Arda Unal
36d8e7056e
[mlir] Enable LICM for ops with only read side effects in scf.for (#120302)
Enable ops with only read side effects in scf.for to be hoisted with a
scf.if guard that checks against the trip count

This patch takes a step towards a less conservative LICM in MLIR as
discussed in the following discourse thread:

[Speculative LICM?](https://discourse.llvm.org/t/speculative-licm/80977)

This patch in particular does the following:

1. Relaxes the original constraint for hoisting that only hoists ops
without any side effects. This patch also allows the ops with only read
side effects to be hoisted into an scf.if guard only if every op in the
loop or its nested regions is side-effect free or has only read side
effects. This scf.if guard wraps the original scf.for and checks for
**trip_count > 0**.
2. To support this, two new interface methods are added to
**LoopLikeInterface**: _wrapInTripCountCheck_ and
_unwrapTripCountCheck_. Implementation starts with wrapping the scf.for
loop into scf.if guard using _wrapInTripCountCheck_ and if there is no
op hoisted into the this guard after we are done processing the
worklist, it unwraps the guard by calling _unwrapTripCountCheck_.
2025-02-11 15:48:57 -08:00
Kevin Gleason
2cf6663d3c
[MLIR] Make generated markdown doc more consistent (#119926)
A few changes to doc generation:

- All summaries are in italics.
- In general each optional block starts and ends with a newline.
- All table elements are enclosed in `|`'s
- Overall reduce the number of >2newlines in a row

Rationale for this change is that our markdown to docs generator
requires a newline before all headers, otherwise it gets inlined into
the line before it, see `### sdy-op-priority-propagate` in the image
below.

<img width="883" alt="image"
src="https://github.com/user-attachments/assets/b795c424-cecb-48df-abbe-aee2030f4491"
/>

That said overall I feel this formatting is more consistent now, here's
a before and after:

- Dialect documentation diff: https://www.diffchecker.com/OVMHoXeL/
- Pass documentation diff: https://www.diffchecker.com/XEJRmW3k/
2025-02-11 14:13:01 -06:00
Tai Ly
20ae283d08
[mlir][tosa] Change the shift of mul to be required (#125297)
Change the shift operand for the mul operator to be a required operand.

Also defined shift to be Tosa_ScalarInt8Tensor which requires that it is
a rank-1 tensor
whose shape is [1] (ie, tensor containing a single element)

Signed-off-by: Tai Ly <tai.ly@arm.com>
2025-02-11 11:02:44 -08:00
Hsiangkai Wang
ab93bd6959
[mlir][tosa] Change ClampOp's min/max attributes (#125197)
This changes Tosa ClampOp attributes to min_val and max_val which are
either integer attributes or float attributes, and adds verify checks
that these attribute element types must match element types of input and
output

Co-authored-by: Tai Ly <tai.ly@arm.com>
2025-02-11 08:02:52 -08:00
Zichen Lu
2a5050aa5e
[mlir][target][nvvm] Perf by stage and store into properties (#126178)
Implement the feature about perf by stage(llvm-ir -> isa, isa->binary).

The results will be stored into the properties, then users can use them
after using GpuModuleToBinary Pass.
2025-02-11 12:58:58 +01:00
Maya Amrami
8cf4c5576d
[mlir][bufferization] Canonicalize to_memref(to_tensor(x)) to a CopyO… (#126692)
…p if memory spaces differ
2025-02-11 13:53:15 +02:00
Tai Ly
1a8d2a4016
[mlir][tosa] Use generic QuantizedType in Conv verifiers (#126275)
Replace UniformQuantizedType by the more generic QuantizedType in Conv verifiers.

Change-Id: Ie1961af931864f801914a62976bc988881ee075e

Signed-off-by: Tai Ly <tai.ly@arm.com>
Co-authored-by: Thibaut Goetghebuer-Planchon <thibaut.goetghebuer-planchon@arm.com>
2025-02-11 10:58:16 +00:00
Adam Siemieniuk
67f59a642f
[mlir][xegpu] Improve scatter attribute definition (#126540)
Refactors XeGPU scatter attribute introducing following:
  - improved docs formatting
  - default initialized parameters
  - invariant checks in attribute verifier
  - removal of additional parsing error
 
The attribute's getters now provide default values simplifying their
usage and scattered tensor descriptor handling.
Related descriptor verifier is updated to avoid check duplication.
2025-02-11 10:05:23 +01:00
jeanPerier
99e1308c41
[mlir][LLVM] handle argument and result attributes in llvm.call and llvm.invoke (#123177)
Update llvm.call/llvm.invoke pretty printer/parser and the llvm ir import/export
to deal with the argument and result attributes.

This patch is made on top of PR 123176 that modified the
CallOpInterface and added the argument and result attributes to
llvm.call and llvm.invoke without doing anything with them.

RFC: https://discourse.llvm.org/t/mlir-rfc-adding-argument-and-result-attributes-to-llvm-call/84107
2025-02-11 09:39:51 +01:00
Longsheng Mou
be354cf381
[mlir][transforms] Process RegionBranchOp with empty region (#123895)
This PR adds process for RegionBranchOp with empty region, such as
'else' region of `scf.if`. Fixes #123246.
2025-02-11 14:43:15 +08:00
Amir Bishara
1d6b31f770
[mlir]linalg][NFC]-Add lit test for tile and fuse transformation (#126216)
Add coverage for the fuse consumer transform for
`linalg.generic` operation with projected permutation indexing maps.
2025-02-11 08:33:20 +02:00
Abid Qadeer
196a1acc7d
[OMPIRBuilder][debug] Fix debug info for variables in target region. (#118314)
When a new function is created to handle OpenMP target region, the
variables used in it are passed as arguments. The scope and the location
of these variable contains still point to te parent function of the
target region. Such variables will fail in Verifier as the scope of the
variables will be different from the containing functions.

Currently, flang is the only user of createOutlinedFunction and it does
not generate any debug data for the the variables in the target region
to avoid this error. When this PR is in, we should be able to remove
this limit in the flang (and anyother client) and have the better debug
experience for the target region.

This PR changes the location and scope of the variables in the target
region to point to correct entities. It is similar to what
fixupDebugInfoPostExtraction does for CodeExtractor. I initially tried
to re-use that function but found quickly that it would require quite a
bit of re-factoring and additions before it could be used. It was much
simpler to make the changes locally.
2025-02-10 18:56:35 +00:00
lonely eagle
7ae78a6cdb
[mlir][vector]add extractInsertFoldConstantOp fold function and apply it to extractOp and insertOp. (#124399)
add extractInsertFoldConstantOp fold function and apply it to extractOp and insertOp.
2025-02-11 00:21:59 +08:00
Rolf Morel
f796bc622a
[MLIR][Linalg] Expose linalg.matmul and linalg.contract via Python API (#126377)
Now that linalg.matmul is in tablegen, "hand write" the Python wrapper
that OpDSL used to derive. Similarly, add a Python wrapper for the new
linalg.contract op.

Required following misc. fixes:
1) make linalg.matmul's parsing and printing consistent w.r.t. whether
indexing_maps occurs before or after operands, i.e. per the tests cases
it comes _before_.
2) tablegen for linalg.contract did not state it accepted an optional
cast attr.
3) In ODS's C++-generating code, expand partial support for `$_builder`
access in `Attr::defaultValue` to full support. This enables access to
the current `MlirContext` when constructing the default value (as is
required when the default value consists of affine maps).
2025-02-10 12:05:13 +00:00
Amir Bishara
7090dff6fe
[mlir][scf]: Add value bound for the computed upper bound of for loop (#126426)
Add additional bound for the induction variable of the `scf.for` such
that:
`%iv <= %lower_bound + (%trip_count - 1) * step`
2025-02-10 11:35:02 +02:00
Mehdi Amini
67b7a2590f
Revert "[mlir] Python: Parse ModuleOp from file path" (#126482)
Reverts llvm/llvm-project#125736

The gcc7 Bot is broken at the moment.
2025-02-10 09:09:58 +01:00
Durgadoss R
2feced1df0
[MLIR][NVVM] Add tcgen05 wait/fence Ops (#126265)
PR #126091 adds intrinsics for tcgen05
wait/fence/commit operations. This patch
adds NVVM Dialect Ops for them.

Signed-off-by: Durgadoss R <durgadossr@nvidia.com>
2025-02-08 21:34:40 +05:30
Thomas Preud'homme
027aa70ea4
[TOSA] Fix negate maxValue computation (#126295)
getInput1Zp() returns an unsigned value which means in case of negative
zero point value the max intermediate value computation currently goes
wrong. Use getInput1ZpAttr() instead which returns an APInt and allows
easy sign extension to int64_t.
2025-02-08 09:23:32 +00:00
Uday Bondhugula
b850ce41db
[MLIR][Affine] Fix private memref creation bug in affine fusion (#126028)
Fix private memref creation bug in affine fusion exposed in the case of
the same memref being loaded from/stored to in producer nest. Make the
private memref replacement sound.

Change affine fusion debug string to affine-fusion - more compact.

Fixes: https://github.com/llvm/llvm-project/issues/48703
2025-02-08 08:35:10 +05:30
Md Abdullah Shahneous Bari
8b12acd2a4
[mlir][vector][spirv] Handle 1-element vector.{load|store} lowering. (#126294)
Add support for single element vector{load|store} lowering to SPIR-V.
Since, SPIR-V converts single element vector to scalars, it needs
special attention for vector{load|store} lowering to spirv{load|store}.
2025-02-07 15:31:47 -06:00
Adam Siemieniuk
8a03658d57
[mlir][xegpu] Tensor descriptor type verifier (#124548)
Adds XeGPU tensor descriptor type verifier.

The type verifier covers general tensor descriptor invariants w.r.t. Xe
ISA semantics.
Related operation verifiers are updated to account for the new
descriptor checks and avoid duplication.
2025-02-07 20:43:05 +01:00
Diego Caballero
2c4dd89902
[mlir][Vector] Introduce poison in LowerVectorBitCast/Broadcast/Transpose (#126180)
This PR continues with the introduction of poison as initialization
vector, in this particular case, in LowerVectorBitCast,
LowerVectorBroadcast and LowerVectorTranspose.
2025-02-07 10:51:24 -08:00
Diego Caballero
5a0075adbb
[mlir][Vector] Generate poison vectors in vector.shape_cast lowering (#125613)
This is the first PR that introduces `ub.poison` vectors as part of a
rewrite/conversion pattern in the Vector dialect. It replaces the
`arith.constant dense<0>` vector initialization for
`vector.insert_slice` ops with a poison vector.

This PR depends on all the previous PRs that introduced support for
poison in Vector operations such as `vector.shuffle`, `vector.extract`,
`vector.insert`, including ODS, canonicalization and lowering support.

This PR may improve end-to-end compilation time through LLVM, depending
on the workloads.
2025-02-07 10:42:55 -08:00
TatWai Chong
571a98722f
[mlir][tosa] Change 'shape' of RESHAPE from attribute to input shape … (#125789)
The shape operand is changed to input shape type since V1.0

Change-Id: I508cc1d67e9b017048b3f29fecf202cb7d707110

Co-authored-by: Won Jeon <won.jeon@arm.com>
2025-02-07 10:24:52 -08:00
Diego Caballero
68325148d3
[mlir][Vector] Fold vector.extract from poison vector (#126122)
This PR adds a folder for `vector.extract(ub.poison) -> ub.poison`. It
also replaces `create` with `createOrFold` insert/extract ops in vector
unroll and transpose lowering patterns to trigger the poison foldings
introduced recently.
2025-02-07 10:20:07 -08:00
Eric Hein
1f67070a3f
[ViewOpGraph] Improve GraphViz output (#125509)
This patch improves the GraphViz output of ViewOpGraph
(--view-op-graph).

- Switch to rectangular record-based nodes, inspired by a similar
visualization in [Glow](https://github.com/pytorch/glow). Rectangles
make more efficient use of space when printing text.
- Add input and output ports for each operand and result, and remove
edge labels.
- Switch to a muted color palette to reduce eye strain.
2025-02-07 10:45:47 -05:00
Igor Wodiany
1454fc9dbf
[mlir][spirv] Add definition for OpGroupNonUniformBallotBitCount (#126055)
A new constraint is also added to restrict attributes values for SPIR-V
attributes. Ideally this should use `ConfinedAttr` with a custom
constraint directly on the operand, however it seems TableGen does not
allow using that with SPIR-V attributes. I suspect it is because SPIR-V
attributes do not derive from the generic MLIR attribute class -
TableGen complains about missing enum field.
2025-02-07 14:20:02 +01:00
Andrzej Warzyński
e346d4752f
[mlir][vector] Categorize Vector-to-LLVM conversion tests (nfc) (#125918)
Following https://github.com/llvm/llvm-project/issues/124308, this patch
reorganizes the `vector-to-llvm.mlir` tests by splitting them into two
categories:

- **Basic conversion tests**: Tests that only require
  `populateVectorToLLVMConversionPatterns`, focusing on the minimal
  conversion from Vector to LLVM. These have been moved to
  `vector-to-llvm-interface.mlir`.
- **Full pass tests**: Tests that require the complete
  `ConvertVectorToLLVMPass`, which includes
  `populateVectorToLLVMConversionPatterns` along with additional
  patterns. These remain in `vector-to-llvm.mlir`.

This reorganization clarifies test coverage and helps avoid unnecessary
duplication.

NOTE: This is merely moving tests around between two files and adds
some comments.
2025-02-07 08:04:59 +00:00
Andrzej Warzyński
6b902efdf6
[mlir][linalg] Add support for masked vectorization of tensor.insert_slice (2/N) (#123031)
For context, recall that `tensor.insert_slice` is vectorised using the
`vector.transfer_read` + `vector.transfer_write` pair. An unmasked
example is shown below:

```mlir
// BEFORE VECTORIZATION
%res = tensor.insert_slice
  %slice into %dest[0, %c2]
  [5, 1] [1, 1] : tensor<5x1xi32> into tensor<5x3xi32>

// AFTER VECTORIZATION
%read = vector.transfer_read %source[%c0, %c0], %pad
  : tensor<5x1xi32>, vector<8x1xi32>
%res = vector.transfer_write %read, %dest[%c0, %c2]
  : vector<8x1xi32>, tensor<5x3xi32>
```

This PR extends `vectorizeAsInsertSliceOp` to add masking support for
the `vector.transfer_write` operation. This complements the changes
in #122927, which introduced masking for the `vector.transfer_read`.
2025-02-07 07:56:24 +00:00
Prashant Kumar
97b08b8ee0
[mlir][amdgpu] Support for 8bit extf for 0d vector type (#126102)
For 0d vector type the rewrite crashes.
2025-02-07 04:15:22 +05:30
Alan Li
f0e1857c84
[MLIR] Support non-atomic RMW option for emulated vector stores (#124887)
This patch is a followup of the previous one: #115922, It adds an option
to turn on emitting non-atomic rmw code sequence instead of atomic rmw.
2025-02-06 13:22:42 -08:00
Md Asghar Ahmad Shahid
f2bca9e385
[MLIR][Linalg] Introduce broadcast/transpose semantic to batch_matmul (#122275)
Goals:
1. To add syntax and semantic to 'batch_matmul' without changing any of
the existing syntax expectations for current usage. batch_matmul is
still just batch_matmul.

2. Move the definition of batch_matmul from linalg OpDsl to tablegen ODS
infra.

Scope of this patch:
To expose broadcast and transpose semantics on the 'batch_matmul'.

The broadcast and transpose semantic are as follows:

By default, 'linalg.batch_matmul' behavior will remain as is. Broadcast
and Transpose semantics can be applied by specifying the explicit
attribute 'indexing_maps' as shown below. This is a list attribute, so
the list must include all the maps if specified.

    Example Transpose:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map< (d0, d1, d2, d3) -> (d0, d3, d1)>, //transpose
                   affine_map< (d0, d1, d2, d3) -> (d0, d3, d2)>,
                   affine_map< (d0, d1, d2, d3) -> (d0, d1, d2)>
                   ]
ins (%arg0, %arg1: memref<2x5x3xf32>,memref<2x5x7xf32>)
                   outs (%arg2: memref<2x3x7xf32>)
    ```

    Example Broadcast:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map< (d0, d1, d2, d3) -> (d3)>, //broadcast
                       affine_map< (d0, d1, d2, d3) -> (d0, d3, d2)>,
                       affine_map< (d0, d1, d2, d3) -> (d0, d1, d2)>
                     ]
                     ins (%arg0, %arg1: memref<5xf32>,memref<2x5x7xf32>)
                     outs (%arg2: memref<2x3x7xf32>)
    ```

    Example Broadcast and transpose:
    ```
    linalg.batch_matmul indexing_maps = [
affine_map< (d0, d1, d2, d3) -> (d1, d3)>, //broadcast
affine_map< (d0, d1, d2, d3) -> (d0, d2, d3)>, //transpose
                       affine_map< (d0, d1, d2, d3) -> (d0, d1, d2)>
                     ]
ins (%arg0, %arg1: memref<3x5xf32>, memref<2x7x5xf32>)
                     outs (%arg2: memref<2x3x7xf32>)
    ```

RFCs and related PR:

https://discourse.llvm.org/t/rfc-linalg-opdsl-constant-list-attribute-definition/80149
https://discourse.llvm.org/t/rfc-op-explosion-in-linalg/82863
https://discourse.llvm.org/t/rfc-mlir-linalg-operation-tree/83586
https://github.com/llvm/llvm-project/pull/115319
2025-02-06 19:08:50 +00:00
Krzysztof Drewniak
f4e3b8783c
[mlir][LLVM] Switch undef for poison for uninitialized values (#125629)
LLVM itself is generally moving away from using `undef` and towards
using `poison`, to the point of having a lint that caches new uses of
`undef` in tests.

In order to not trip the lint on new patterns and to conform to the
evolution of LLVM
- Rename valious ::undef() methods on StructBuilder subclasses to
::poison()
- Audit the uses of UndefOp in the MLIR libraries and replace almost all
of them with PoisonOp

The remaining uses of `undef` are initializing `uninitialized` memrefs,
explicit conversions to undef from SPIR-V, and a few cases in
AMDGPUToROCDL where usage like

    %v = insertelement <M x iN> undef, iN %v, i32 0
    %arg = bitcast <M x iN> %v to i(M * N)

is used to handle "i32" arguments that are are really packed vectors of
smaller types that won't always be fully initialized.
2025-02-06 12:49:30 -06:00
Kareem Ergawy
dcb124e820
[flang][OpenMP] Enable delayed privatization by default omp.wsloop (#125732)
Reapplies #122471

This is based on https://github.com/llvm/llvm-project/pull/125699, only
the latest commit is relevant.

With changes in this PR and the parent one, the previously reported
failures in the Fujitsu(*) test suite should hopefully be resolved (I
verified all the 14 reported failures and they pass now).

(*) https://linaro.atlassian.net/browse/LLVM-1521
2025-02-06 19:11:04 +01:00
Andrea Faulds
f497fe464b
[mlir][spirv] Fix some issues related to converting ub.poison to SPIR-V (#125905)
This is a follow-up to 5df62bdc9be9c258c5ac45c8093b71e23777fa0e. That
commit should not have needed to make the vector.insert and
vector.extract conversions to SPIR-V directly handle the static poison
index case, as there is a fold from those to ub.poison, and a conversion
pattern from ub.poison to spirv.Undef, however:

- The ub.poison fold result could not be materialized by the vector
dialect (fixed as of d13940ee263ff50b7a71e21424913cc0266bf9d4).
- The conversion pattern wasn't being populated in VectorToSPIRVPass,
which is used by the tests. This commit changes this.
- The ub.poison to spirv.Undef pattern rejected non-scalar types, which
prevented its use for vector results. It is unclear why this restriction
existed; a remark in D156163 said this was to avoid converting "user
types", but it is not obvious why these shouldn't be permitted (the
SPIR-V specification allows OpUndef for all types except OpTypeVoid).
This commit removes this restriction.

With these fixed, this commit removes the redundant static poison index
handling, and updates the tests.
2025-02-06 19:07:34 +01:00