Skip to content

Commit 7d3d898

Browse files
Check driver version in SPIRV translator patch
1 parent 561f2ab commit 7d3d898

File tree

2 files changed

+7
-3
lines changed

2 files changed

+7
-3
lines changed

third_party/intel/backend/compiler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -409,6 +409,8 @@ def make_llir(cls, src, metadata, options):
409409
@classmethod
410410
@track
411411
def make_spv(cls, src, metadata, options):
412+
driver_version = metadata["target"].arch.get("driver_version")
413+
os.environ["INTEL_XPU_BACKEND_DRIVER_VERSION"] = driver_version
412414
spirv, name = intel.translate_to_spirv(src)
413415
metadata["name"] = name
414416
metadata.setdefault("build_flags", "")

third_party/intel/cmake/3122.patch

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
diff --git a/lib/SPIRV/SPIRVWriter.cpp b/lib/SPIRV/SPIRVWriter.cpp
2-
index ec4ec41f..9cad08d8 100644
2+
index ec4ec41f..6d89e29c 100644
33
--- a/lib/SPIRV/SPIRVWriter.cpp
44
+++ b/lib/SPIRV/SPIRVWriter.cpp
5-
@@ -401,13 +401,15 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
5+
@@ -401,13 +401,17 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
66
}
77

88
if (T->isBFloatTy()) {
@@ -13,7 +13,9 @@ index ec4ec41f..9cad08d8 100644
1313
- "NOTE: LLVM module contains bfloat type, translation of which "
1414
- "requires this extension");
1515
- return mapType(T, BM->addFloatType(16, FPEncodingBFloat16KHR));
16-
+ if (BM->isAllowedToUseExtension(ExtensionID::SPV_KHR_bfloat16)) {
16+
+ // Workaround for LTS2 driver.
17+
+ const char *driverVersion = std::getenv("INTEL_XPU_BACKEND_DRIVER_VERSION");
18+
+ if (driverVersion && std::string(driverVersion) != "1.6.33578+38") {
1719
+ BM->getErrorLog().checkError(
1820
+ BM->isAllowedToUseExtension(ExtensionID::SPV_KHR_bfloat16),
1921
+ SPIRVEC_RequiresExtension,

0 commit comments

Comments
 (0)