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

Amr Hesham llvmlistbot at llvm.org
Sat Aug 17 01:49:17 PDT 2024


https://github.com/AmrDeveloper updated https://github.com/llvm/llvm-project/pull/104242

>From b6767028bab8958baa03666b9345af2bbcccffda Mon Sep 17 00:00:00 2001
From: AmrDeveloper <amr96 at programmer.net>
Date: Wed, 14 Aug 2024 23:18:07 +0200
Subject: [PATCH] [mlir][spirv] Fix incorrect metadata in SPIR-V Header

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
---
 mlir/lib/Target/SPIRV/SPIRVBinaryUtils.cpp | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

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