[Mlir-commits] [mlir] [mlir][spirv] Fix incorrect metadata in SPIR-V Header (PR #104242)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Wed Aug 14 14:25:07 PDT 2024
llvmbot wrote:
<!--LLVM PR SUMMARY COMMENT-->
@llvm/pr-subscribers-mlir
Author: Amr Hesham (AmrDeveloper)
<details>
<summary>Changes</summary>
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, So fix the metadata generator to put the version major and minor in the low 16 bits
fixes: #<!-- -->99071
---
Full diff: https://github.com/llvm/llvm-project/pull/104242.diff
1 Files Affected:
- (modified) mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp (+2-2)
``````````diff
diff --git a/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp b/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp
index 3c8f64419d379e..ee75639fa016e4 100644
--- a/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp
+++ b/mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp
@@ -42,7 +42,7 @@ void spirv::appendModuleHeader(SmallVectorImpl<uint32_t> &header,
// +-------------------------------------------------------------------------+
// | Magic number |
// +-------------------------------------------------------------------------+
- // | Version number (bytes: 0 | major number | minor number | 0) |
+ // | Version number (bytes: 0 | 0 | major number | minor number) |
// +-------------------------------------------------------------------------+
// | Generator magic number |
// +-------------------------------------------------------------------------+
@@ -51,7 +51,7 @@ void spirv::appendModuleHeader(SmallVectorImpl<uint32_t> &header,
// | 0 (reserved for instruction schema) |
// +-------------------------------------------------------------------------+
header.push_back(spirv::kMagicNumber);
- header.push_back((majorVersion << 16) | (minorVersion << 8));
+ header.push_back((majorVersion << 8) | minorVersion);
header.push_back(kGeneratorNumber);
header.push_back(idBound); // <id> bound
header.push_back(0); // Schema (reserved word)
``````````
</details>
https://github.com/llvm/llvm-project/pull/104242
More information about the Mlir-commits
mailing list