[all-commits] [llvm/llvm-project] abb0b4: [mlir-c] Add 1:N TypeConverter conversion and mate...
Maksim Levental via All-commits
all-commits at lists.llvm.org
Sat Jul 18 11:41:56 PDT 2026
Branch: refs/heads/users/makslevental/mlir-c-typeconverter-1ton
Home: https://github.com/llvm/llvm-project
Commit: abb0b4ec86a0d6c5217d0211419b4b09863c500a
https://github.com/llvm/llvm-project/commit/abb0b4ec86a0d6c5217d0211419b4b09863c500a
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
M mlir/include/mlir-c/Rewrite.h
M mlir/lib/CAPI/Transforms/Rewrite.cpp
M mlir/test/CAPI/rewrite.c
Log Message:
-----------
[mlir-c] Add 1:N TypeConverter conversion and materialization bindings
Builds on the source/target materialization C bindings:
- Target materialization callbacks now receive `originalType` (split from the
previously-shared source/target callback typedef), exposing a documented C++
capability that was otherwise unreachable from C.
- 1:N type conversion: `mlirTypeConverterAdd1ToNConversion` plus an opaque
results accumulator (`MlirTypeConverterConversionResults` /
`mlirTypeConverterConversionResultsAppend`). A declining callback's appended
types are rolled back so the driver's "try the next conversion" invariant
holds.
- 1:N target materialization: `mlirTypeConverterAdd1ToNTargetMaterialization`,
whose callback fills a caller-allocated `outputs` buffer. A success that
leaves any output null is treated as a decline rather than handing the driver
a null-containing result.
- `mlirConversionPatternRewriterReplaceOpWithMultiple` for 1:N value
replacement, which can drive a source materialization with nInputs > 1.
- An optional `matchAndRewrite1ToN` callback on `MlirConversionPatternCallbacks`
for patterns consuming 1:N-remapped operands; when null the driver falls back
to the 1:1 dispatch.
Adds end-to-end tests in mlir/test/CAPI/rewrite.c covering originalType
observation, source/target materialization decline paths, 1:N conversion
(including append-then-decline rollback and erasure), 1:N target
materialization (including the unfilled-outputs decline), multi-input source
materialization, multi-range replaceOpWithMultiple, and the 1:1-only-pattern
vs 1:N-operand failure.
Commit: 0f794b4cd5943c2861be125579b8ecc0b19226af
https://github.com/llvm/llvm-project/commit/0f794b4cd5943c2861be125579b8ecc0b19226af
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
M mlir/test/CAPI/rewrite.c
Log Message:
-----------
[mlir-c] Fix -Wmissing-field-initializers in rewrite.c test
The new matchAndRewrite1ToN field left three existing
MlirConversionPatternCallbacks initializers under-initialized, which
fails the CI build under -Werror=-Wmissing-field-initializers.
Commit: 56262f342585e47b6ffd5153e788b12a8514b493
https://github.com/llvm/llvm-project/commit/56262f342585e47b6ffd5153e788b12a8514b493
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
M mlir/lib/Bindings/Python/Rewrite.cpp
Log Message:
-----------
[mlir-c] Value-initialize MlirConversionPatternCallbacks in Python bindings
The Python conversion-pattern binding left the struct default-initialized,
so the newly-added optional matchAndRewrite1ToN field held an indeterminate
pointer. The driver's null check then read garbage and jumped into it,
segfaulting mlir/test/python/rewrite.py. Value-initialize the struct so
optional callbacks default to null.
Commit: 785b59543b972bf05c786abf2efdfb01d38fc9f9
https://github.com/llvm/llvm-project/commit/785b59543b972bf05c786abf2efdfb01d38fc9f9
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
M mlir/test/CAPI/rewrite.c
Log Message:
-----------
pre-increment
Commit: 97d9dbe270808b9113cfd605d3b849bd33a5e7f1
https://github.com/llvm/llvm-project/commit/97d9dbe270808b9113cfd605d3b849bd33a5e7f1
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
M mlir/include/mlir-c/Rewrite.h
M mlir/lib/CAPI/Transforms/Rewrite.cpp
Log Message:
-----------
cleanup comments
Commit: 2e42e0ca59e3f5f2e0d92340c610c7cf41d153bd
https://github.com/llvm/llvm-project/commit/2e42e0ca59e3f5f2e0d92340c610c7cf41d153bd
Author: makslevental <maksim.levental at gmail.com>
Date: 2026-07-18 (Sat, 18 Jul 2026)
Changed paths:
M mlir/include/mlir-c/Rewrite.h
M mlir/lib/CAPI/Transforms/Rewrite.cpp
M mlir/test/CAPI/rewrite.c
Log Message:
-----------
[mlir-c] Expose hard-failure state in 1:N type conversion callback
The 1:N conversion callback returned MlirLogicalResult, which the binding
could only map to success or nullopt (try-another), leaving the C++
failure() state (fail without trying another conversion) unreachable.
Return a MlirTypeConverterConversionStatus enum instead, with Success,
Failure, and Declined states mapped to success(), failure(), and
std::nullopt respectively. Add a test covering the hard-failure path.
Compare: https://github.com/llvm/llvm-project/compare/e4b62b0279fa...2e42e0ca59e3
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