Skip to content

Commit a5d6a6f

Browse files
address review comment
1 parent 7d3d898 commit a5d6a6f

File tree

1 file changed

+16
-10
lines changed

1 file changed

+16
-10
lines changed

third_party/intel/cmake/3122.patch

Lines changed: 16 additions & 10 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..6d89e29c 100644
2+
index ec4ec41f..b481609f 100644
33
--- a/lib/SPIRV/SPIRVWriter.cpp
44
+++ b/lib/SPIRV/SPIRVWriter.cpp
5-
@@ -401,13 +401,17 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
5+
@@ -401,13 +401,23 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
66
}
77

88
if (T->isBFloatTy()) {
@@ -15,14 +15,20 @@ index ec4ec41f..6d89e29c 100644
1515
- return mapType(T, BM->addFloatType(16, FPEncodingBFloat16KHR));
1616
+ // Workaround for LTS2 driver.
1717
+ const char *driverVersion = std::getenv("INTEL_XPU_BACKEND_DRIVER_VERSION");
18-
+ if (driverVersion && std::string(driverVersion) != "1.6.33578+38") {
19-
+ BM->getErrorLog().checkError(
20-
+ BM->isAllowedToUseExtension(ExtensionID::SPV_KHR_bfloat16),
21-
+ SPIRVEC_RequiresExtension,
22-
+ "SPV_KHR_bfloat16\n"
23-
+ "NOTE: LLVM module contains bfloat type, translation of which "
24-
+ "requires this extension");
25-
+ return mapType(T, BM->addFloatType(16, FPEncodingBFloat16KHR));
18+
+ if (driverVersion) {
19+
+ int v0 = 0, v1 = 0, v2 = 0, v3 = 0;
20+
+ sscanf(driverVersion, "%d.%d.%d+%d", &v0, &v1, &v2, &v3);
21+
+ std::tuple<int, int, int, int> ver = {v0, v1, v2, v3};
22+
+ std::tuple<int, int, int, int> minVer = {1, 6, 35096, 9};
23+
+ if (ver >= minVer) {
24+
+ BM->getErrorLog().checkError(
25+
+ BM->isAllowedToUseExtension(ExtensionID::SPV_KHR_bfloat16),
26+
+ SPIRVEC_RequiresExtension,
27+
+ "SPV_KHR_bfloat16\n"
28+
+ "NOTE: LLVM module contains bfloat type, translation of which "
29+
+ "requires this extension");
30+
+ return mapType(T, BM->addFloatType(16, FPEncodingBFloat16KHR));
31+
+ }
2632
+ }
2733
}
2834

0 commit comments

Comments
 (0)