[all-commits] [llvm/llvm-project] bb1558: [mlir-c] Add 1:N TypeConverter conversion and mate...
Maksim Levental via All-commits
all-commits at lists.llvm.org
Sat Jul 18 11:45:25 PDT 2026
Branch: refs/heads/users/makslevental/mlir-c-typeconverter-1ton
Home: https://github.com/llvm/llvm-project
Commit: bb1558c821f5272cd9d4f41fb80d99f66d4331f5
https://github.com/llvm/llvm-project/commit/bb1558c821f5272cd9d4f41fb80d99f66d4331f5
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: c40aa29674ce69f38771b27ed52a06524eb3933d
https://github.com/llvm/llvm-project/commit/c40aa29674ce69f38771b27ed52a06524eb3933d
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: ffecab78a8afeca16b2d47d8b138db7da8b6768a
https://github.com/llvm/llvm-project/commit/ffecab78a8afeca16b2d47d8b138db7da8b6768a
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: f172a8a173ce91da56435d7c7f834d704b7a4070
https://github.com/llvm/llvm-project/commit/f172a8a173ce91da56435d7c7f834d704b7a4070
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: 6c84a6b5b581d251f1cfbc385437cd8383ac6bef
https://github.com/llvm/llvm-project/commit/6c84a6b5b581d251f1cfbc385437cd8383ac6bef
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: 3480c9d80cd37ccfad7ee05e34b63eac286e8646
https://github.com/llvm/llvm-project/commit/3480c9d80cd37ccfad7ee05e34b63eac286e8646
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/2e42e0ca59e3...3480c9d80cd3
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