Skip to content

Commit 9fc51d2

Browse files
committed
[mlir][spirv] Fix SPIR-V translation registration
'From' and 'To' should be reversed. And now we must explicitly call the registration function given that MLIR moved away from static registration. Differential Revision: https://reviews.llvm.org/D78934
1 parent 58435f6 commit 9fc51d2

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

mlir/include/mlir/InitAllTranslations.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
namespace mlir {
1818

1919
void registerFromLLVMIRTranslation();
20+
void registerFromSPIRVTranslation();
2021
void registerToLLVMIRTranslation();
2122
void registerToSPIRVTranslation();
2223
void registerToNVVMIRTranslation();
@@ -29,6 +30,7 @@ void registerAVX512ToLLVMIRTranslation();
2930
inline void registerAllTranslations() {
3031
static bool init_once = []() {
3132
registerFromLLVMIRTranslation();
33+
registerFromSPIRVTranslation();
3234
registerToLLVMIRTranslation();
3335
registerToSPIRVTranslation();
3436
registerToNVVMIRTranslation();

mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ static OwningModuleRef deserializeModule(const llvm::MemoryBuffer *input,
6161
}
6262

6363
namespace mlir {
64-
void registerToSPIRVTranslation() {
64+
void registerFromSPIRVTranslation() {
6565
TranslateToMLIRRegistration fromBinary(
6666
"deserialize-spirv",
6767
[](llvm::SourceMgr &sourceMgr, MLIRContext *context) {
@@ -101,7 +101,7 @@ static LogicalResult serializeModule(ModuleOp module, raw_ostream &output) {
101101
}
102102

103103
namespace mlir {
104-
void registerFromSPIRVTranslation() {
104+
void registerToSPIRVTranslation() {
105105
TranslateFromMLIRRegistration toBinary(
106106
"serialize-spirv", [](ModuleOp module, raw_ostream &output) {
107107
return serializeModule(module, output);

0 commit comments

Comments
 (0)