Skip to content

Commit c63305b

Browse files
address review comment
1 parent 7d3d898 commit c63305b

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

third_party/intel/cmake/3122.patch

Lines changed: 14 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..ab5fee13 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,21 @@ SPIRVType *LLVMToSPIRVBase::transType(Type *T) {
66
}
77

88
if (T->isBFloatTy()) {
@@ -15,14 +15,18 @@ 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+
+ if (v0 > 1 || v1 > 6 || v2 > 35096 || v3 >= 9) {
22+
+ BM->getErrorLog().checkError(
23+
+ BM->isAllowedToUseExtension(ExtensionID::SPV_KHR_bfloat16),
24+
+ SPIRVEC_RequiresExtension,
25+
+ "SPV_KHR_bfloat16\n"
26+
+ "NOTE: LLVM module contains bfloat type, translation of which "
27+
+ "requires this extension");
28+
+ return mapType(T, BM->addFloatType(16, FPEncodingBFloat16KHR));
29+
+ }
2630
+ }
2731
}
2832

0 commit comments

Comments
 (0)