Multi-Level IR Compiler Framework

Deprecations & Current Refactoring

This page collects current deprecations in MLIR of API and features we intend to remove soon, as well as large refactoring an migration on-going. We try to list these here for the purpose of helping downstream users keeping up with MLIR development.


Use the free function variants for dyn_cast/cast/isa/…

When casting attributes or type, use the free functions variants, e.g., dyn_cast<T>(x), isa<T>(x), etc. Use of the cast methods variants (e.g., x.dyn_cast<T>()) should be avoided in new code as we’ll remove these methods in the future. Discussion on Discourse

Port uses of LLVM Dialect to opaque pointers

LLVM 17 has stopped officially supporting typed pointers and MLIRs LLVM Dialect will follow suit soon by removing them. Users of the LLVM Dialect must switch to using opaque pointers and stop relying on pointers having an element type. See the initial PSA post for precise instructions and timeline.

On-going Refactoring & large changes

Past Deprecation and Refactoring


“Promised Interface” and the need to explicitly register InlinerExtension for the FuncDialect.

We’re tightening the contract around injecting interfaces into the system externally, starting with DialectInterface. As an important visible change at the moment is that if you’re using the inliner with the FuncDialect, you need to call func::registerAllExtensions(registry); when setting up your MLIRContext.

Properties && changes to the generic printing format

See on Discourse.

Properties is a new feature in MLIR that will allow to separate the storage of inherent attributes from the discardable ones. One key visible change is the generic assembly format which gain a new attribute entry in-between < >.

preloadDialectInContext has been deprecated for >1y and was removed


If you have an mlir-opt tool and you’re still depending on preloadDialectInContext, you need to revisit your pipeline. This option used with mlir-opt is hiding issues with the pipeline, and indications of missing getDependentDialects(). Discussion on Discourse

Migrating mlir-opt-like tools to use MlirOptMainConfig


If your mlir-opt-like tool is using the MlirOptMain(int argc, char **argv, ...) entry point you won’t be affected, otherwise, see the Discussion on Discourse

Deprecation of gpu-to-(cubin|hsaco) in favor of GPU compilation attributes

GPU compilation attributes are a completely new mechanism for handling the compilation of GPU modules down to binary or other formats in an extensible way. This mechanism lifts many current restrictions the GPU serialization passes had, like being present only if the CUDA driver is there or not linking to LibDevice.

One key difference is the usage of ptxas or the nvptxcompiler library for compiling PTX to binary; hence the CUDATollkit is required for generating binaries.

For these attributes to work correctly, making registration calls to registerNVVMTargetInterfaceExternalModels, registerROCDLTargetInterfaceExternalModels and registerOffloadingLLVMTranslationInterfaceExternalModels are necessary.

The passes gpu-to-(cubin|hsaco) will be removed in a future release.