diff --git a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h --- a/mlir/include/mlir/Target/LLVMIR/Dialect/All.h +++ b/mlir/include/mlir/Target/LLVMIR/Dialect/All.h @@ -60,6 +60,18 @@ ROCDL::registerROCDLTargetInterfaceExternalModels(registry); } +/// Registers all the translations to LLVM IR required by GPU passes. +/// TODO: Remove this function when a safe dialect interface registration +/// mechanism is implemented, see D157703. +static inline void +registerAllGPUToLLVMIRTranslations(DialectRegistry ®istry) { + registerBuiltinDialectTranslation(registry); + registerGPUDialectTranslation(registry); + registerLLVMDialectTranslation(registry); + registerNVVMDialectTranslation(registry); + registerROCDLDialectTranslation(registry); +} + /// Registers all dialects that can be translated from LLVM IR and the /// corresponding translation interfaces. static inline void diff --git a/mlir/tools/mlir-opt/mlir-opt.cpp b/mlir/tools/mlir-opt/mlir-opt.cpp --- a/mlir/tools/mlir-opt/mlir-opt.cpp +++ b/mlir/tools/mlir-opt/mlir-opt.cpp @@ -276,7 +276,7 @@ DialectRegistry registry; registerAllDialects(registry); registerAllExtensions(registry); - registerAllToLLVMIRTranslations(registry); + registerAllGPUToLLVMIRTranslations(registry); #ifdef MLIR_INCLUDE_TESTS ::test::registerTestDialect(registry);