[Mlir-commits] [mlir] 3b80a28 - [mlir][spirv] Fix incorrect metadata in SPIR-V Header (#104242)

llvmlistbot at llvm.org llvmlistbot at llvm.org
Mon Aug 19 11:58:10 PDT 2024


Author: Amr Hesham
Date: 2024-08-19T14:58:06-04:00
New Revision: 3b80a28c8f27536f49e5fa30a7e2b7050bad6cd6

URL: https://github.com/llvm/llvm-project/commit/3b80a28c8f27536f49e5fa30a7e2b7050bad6cd6
DIFF: https://github.com/llvm/llvm-project/commit/3b80a28c8f27536f49e5fa30a7e2b7050bad6cd6.diff

LOG: [mlir][spirv] Fix incorrect metadata in SPIR-V Header (#104242)

SRIP-V Generator Magic Number is a 32 bit word: The high order 16 bits
are a tool ID. The low order 16 bits are for verion number, currently
the tool id is not on the high order 16 bit so it must shifed

fixes: #99071

Added: 
    

Modified: 
    mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp

Removed: 
    


################################################################################
diff  --git a/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp b/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp
index 3c8f64419d379e..18a108be764b37 100644
--- a/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp
+++ b/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp
@@ -52,7 +52,7 @@ void spirv::appendModuleHeader(SmallVectorImpl<uint32_t> &header,
   // +-------------------------------------------------------------------------+
   header.push_back(spirv::kMagicNumber);
   header.push_back((majorVersion << 16) | (minorVersion << 8));
-  header.push_back(kGeneratorNumber);
+  header.push_back((kGeneratorNumber << 16) | LLVM_VERSION_MAJOR);
   header.push_back(idBound); // <id> bound
   header.push_back(0);       // Schema (reserved word)
 }


        


More information about the Mlir-commits mailing list