Issue 137147
Summary [mlir][vector] Update how OOB accesses are handled by vector.extract/vector.insert
Labels mlir:vectorops, mlir:vector
Assignees banach-space
Reporter banach-space
    At the moment, only `-1` is used to "model" poison values - i.e., accesses that produce poison:

```mlir
  %c_neg_1 = arith.constant -1 : index
  %0 = vector.insert %value_to_store, %dest[%c_neg_1] : vector<5xf32> into vector<4x5xf32>
  %1 = vector.extract %src[%c_neg_1, 0] : f32 from vector<4x5xf32>
```

>From the discussion so far, it seems that:
* We should treat any out-of-bounds (OOB) index — not just `-1` — as producing a poison value (see [@dcaballe’s supportive comment](https://github.com/llvm/llvm-project/issues/134516#issuecomment-2789687910)).
* We should allow using `%poison = ub.poison : index` directly as an index that generates poison.

This direction would bring the dialect more in line with LLVM semantics. From [LLVM LangRef](https://llvm.org/docs/LangRef.html#id184):

> If idx exceeds the length of val for a fixed-length vector, the result is a [poison value](https://llvm.org/docs/LangRef.html#poisonvalues)

**VOICES AGAINST / CONCERNS**

We should be mindful of [@kuhar’s comment](https://github.com/llvm/llvm-project/issues/134516#issuecomment-2781890324). While not opposed to the proposed direction:

> If others would prefer consistency with the LLVM instructions, I won't object.

... we should keep him in the loop and ensure any concerns he raises are addressed.

**PRIOR DISCUSSION**

Relevant context and discussion can be found in:
* https://github.com/llvm/llvm-project/issues/134516
* https://github.com/llvm/llvm-project/pull/135498
* https://github.com/llvm/llvm-project/pull/136579
 
Also, this issue is to track **NEXT STEPS** from this [comment](https://github.com/llvm/llvm-project/pull/136579#issuecomment-2821065107).
_______________________________________________
llvm-bugs mailing list
llvm-bugs@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to