[all-commits] [llvm/llvm-project] 2a9063: [mlir][spirv] Allow yielding values from selection...
Igor Wodiany via All-commits
all-commits at lists.llvm.org
Wed Apr 2 06:35:44 PDT 2025
Branch: refs/heads/main
Home: https://github.com/llvm/llvm-project
Commit: 2a90631841284ba538029975e59876bb2e1714af
https://github.com/llvm/llvm-project/commit/2a90631841284ba538029975e59876bb2e1714af
Author: Igor Wodiany <igor.wodiany at imgtec.com>
Date: 2025-04-02 (Wed, 02 Apr 2025)
Changed paths:
M mlir/docs/Dialects/SPIR-V.md
M mlir/include/mlir/Dialect/SPIRV/IR/SPIRVControlFlowOps.td
M mlir/lib/Dialect/SPIRV/IR/ControlFlowOps.cpp
M mlir/lib/Target/SPIRV/Deserialization/Deserializer.cpp
M mlir/lib/Target/SPIRV/Serialization/SerializeOps.cpp
M mlir/test/Dialect/SPIRV/IR/control-flow-ops.mlir
M mlir/test/Target/SPIRV/selection.mlir
Log Message:
-----------
[mlir][spirv] Allow yielding values from selection regions (#133702)
There are cases in SPIR-V shaders where values need to be yielded from
the selection region to make valid MLIR. For example (part of the SPIR-V
shader decompiled to GLSL):
```
bool _115
if (_107)
{
// ...
float _200 = fma(...);
// ...
_115 = _200 < _174;
}
else
{
_115 = _107;
}
bool _123;
if (_115)
{
// ...
float _213 = fma(...);
// ...
_123 = _213 < _174;
}
else
{
_123 = _115;
}
````
This patch extends `mlir.selection` so it can return values.
`mlir.merge` is used as a "yield" operation. This allows to maintain a
compatibility with code that does not yield any values, as well as, to
maintain an assumption that `mlir.merge` is the only operation in the
merge block of the selection region.
To unsubscribe from these emails, change your notification settings at https://github.com/llvm/llvm-project/settings/notifications
More information about the All-commits
mailing list