Skip to content

Commit 03a7cce

Browse files
authored
Add clang patch to enable BFloat16 for SPIR/SPIR-V (#589)
1 parent 81cf510 commit 03a7cce

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
From aa7569682dce21e7eb394bfca37229609aebeabe Mon Sep 17 00:00:00 2001
2+
From: Wenju He <[email protected]>
3+
Date: Fri, 21 Nov 2025 05:30:46 +0100
4+
Subject: [PATCH] [Clang] Enable BFloat16 for SPIR/SPIR-V
5+
6+
---
7+
clang/lib/Basic/Targets/SPIR.h | 4 ++++
8+
1 file changed, 4 insertions(+)
9+
10+
diff --git a/clang/lib/Basic/Targets/SPIR.h b/clang/lib/Basic/Targets/SPIR.h
11+
index fa4a3bb1c82e..2f2c16a2bb06 100644
12+
--- a/clang/lib/Basic/Targets/SPIR.h
13+
+++ b/clang/lib/Basic/Targets/SPIR.h
14+
@@ -101,6 +101,10 @@ protected:
15+
UseAddrSpaceMapMangling = true;
16+
HasLegalHalfType = true;
17+
HasFloat16 = true;
18+
+ HasBFloat16 = true;
19+
+ BFloat16Width = BFloat16Align = 16;
20+
+ BFloat16Format = &llvm::APFloat::BFloat();
21+
+
22+
// Define available target features
23+
// These must be defined in sorted order!
24+
NoAsmVariants = true;
25+
--
26+
2.39.1
27+

0 commit comments

Comments
 (0)