[Mlir-commits] [mlir] 9fc51d2 - [mlir][spirv] Fix SPIR-V translation registration

Lei Zhang llvmlistbot at llvm.org
Mon Apr 27 10:23:49 PDT 2020


Author: Lei Zhang
Date: 2020-04-27T13:23:32-04:00
New Revision: 9fc51d23db7fddf7fe6f426746cdb680d8d7fa1a

URL: https://github.com/llvm/llvm-project/commit/9fc51d23db7fddf7fe6f426746cdb680d8d7fa1a
DIFF: https://github.com/llvm/llvm-project/commit/9fc51d23db7fddf7fe6f426746cdb680d8d7fa1a.diff

LOG: [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

Added: 
    

Modified: 
    mlir/include/mlir/InitAllTranslations.h
    mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/include/mlir/InitAllTranslations.h b/mlir/include/mlir/InitAllTranslations.h
index 4952713c3828..8efae67df205 100644
--- a/mlir/include/mlir/InitAllTranslations.h
+++ b/mlir/include/mlir/InitAllTranslations.h
@@ -17,6 +17,7 @@
 namespace mlir {
 
 void registerFromLLVMIRTranslation();
+void registerFromSPIRVTranslation();
 void registerToLLVMIRTranslation();
 void registerToSPIRVTranslation();
 void registerToNVVMIRTranslation();
@@ -29,6 +30,7 @@ void registerAVX512ToLLVMIRTranslation();
 inline void registerAllTranslations() {
   static bool init_once = []() {
     registerFromLLVMIRTranslation();
+    registerFromSPIRVTranslation();
     registerToLLVMIRTranslation();
     registerToSPIRVTranslation();
     registerToNVVMIRTranslation();

diff  --git a/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp b/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp
index 4850be5ceb48..85bc95740904 100644
--- a/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp
+++ b/mlir/lib/Dialect/SPIRV/Serialization/TranslateRegistration.cpp
@@ -61,7 +61,7 @@ static OwningModuleRef deserializeModule(const llvm::MemoryBuffer *input,
 }
 
 namespace mlir {
-void registerToSPIRVTranslation() {
+void registerFromSPIRVTranslation() {
   TranslateToMLIRRegistration fromBinary(
       "deserialize-spirv",
       [](llvm::SourceMgr &sourceMgr, MLIRContext *context) {
@@ -101,7 +101,7 @@ static LogicalResult serializeModule(ModuleOp module, raw_ostream &output) {
 }
 
 namespace mlir {
-void registerFromSPIRVTranslation() {
+void registerToSPIRVTranslation() {
   TranslateFromMLIRRegistration toBinary(
       "serialize-spirv", [](ModuleOp module, raw_ostream &output) {
         return serializeModule(module, output);


        


More information about the Mlir-commits mailing list