File tree Expand file tree Collapse file tree 3 files changed +39
-8
lines changed Expand file tree Collapse file tree 3 files changed +39
-8
lines changed Original file line number Diff line number Diff line change @@ -108,6 +108,10 @@ class LLVM_LIBRARY_VISIBILITY BaseSPIRTargetInfo : public TargetInfo {
108108 UseAddrSpaceMapMangling = true ;
109109 HasFastHalfType = true ;
110110 HasFloat16 = true ;
111+ HasBFloat16 = true ;
112+ HasFullBFloat16 = true ;
113+ BFloat16Width = BFloat16Align = 16 ;
114+ BFloat16Format = &llvm::APFloat::BFloat ();
111115 // Define available target features
112116 // These must be defined in sorted order!
113117 NoAsmVariants = true ;
@@ -427,18 +431,13 @@ class LLVM_LIBRARY_VISIBILITY SPIRV64AMDGCNTargetInfo final
427431 resetDataLayout (" e-i64:64-v16:16-v24:32-v32:32-v48:64-v96:128-v192:256-"
428432 " v256:256-v512:512-v1024:1024-n32:64-S32-G1-P4-A0" );
429433
430- BFloat16Width = BFloat16Align = 16 ;
431- BFloat16Format = &llvm::APFloat::BFloat ();
432-
433434 HasFastHalfType = true ;
434435 HasFloat16 = true ;
435436 HalfArgsAndReturns = true ;
436437
437438 MaxAtomicPromoteWidth = MaxAtomicInlineWidth = 64 ;
438439 }
439440
440- bool hasBFloat16Type () const override { return true ; }
441-
442441 ArrayRef<const char *> getGCCRegNames () const override ;
443442
444443 BuiltinVaListKind getBuiltinVaListKind () const override {
Original file line number Diff line number Diff line change 1+ // RUN: %clang_cc1 %s -cl-std=cl3.0 -emit-llvm -o - -triple spir-unknown-unknown | FileCheck %s
2+ // RUN: %clang_cc1 %s -cl-std=cl3.0 -emit-llvm -o - -triple spirv64-unknown-unknown | FileCheck %s
3+
4+ kernel void test (global __bf16 * a , global __bf16 * b ){
5+ // CHECK-LABEL: spir_kernel void @test(
6+ // CHECK: fadd bfloat
7+ // CHECK: fsub bfloat
8+ // CHECK: fmul bfloat
9+ // CHECK: fdiv bfloat
10+
11+ * b += * a ;
12+ * b -= * a ;
13+ * b *= * a ;
14+ * b /= * a ;
15+ }
16+
17+ typedef __bf16 __bf16v4 __attribute((ext_vector_type (4 )));
18+
19+ kernel void test_v4 (global __bf16v4 * a , global __bf16v4 * b ){
20+ // CHECK-LABEL: spir_kernel void @test_v4(
21+ // CHECK: fadd <4 x bfloat>
22+ // CHECK: fsub <4 x bfloat>
23+ // CHECK: fmul <4 x bfloat>
24+ // CHECK: fdiv <4 x bfloat>
25+
26+ * b += * a ;
27+ * b -= * a ;
28+ * b *= * a ;
29+ * b /= * a ;
30+ }
31+
Original file line number Diff line number Diff line change 11// RUN: %clang_cc1 -triple spir64 -aux-triple x86_64-unknown-linux-gnu -fsycl-is-device -verify -fsyntax-only %s
2+ // expected-no-diagnostics
23
34template <typename Name, typename Func>
45__attribute__ ((sycl_kernel)) void kernel(const Func &kernelFunc) {
5- kernelFunc (); // expected-note {{called by 'kernel}}
6+ kernelFunc ();
67}
78
89void host_ok (void ) {
@@ -11,9 +12,9 @@ void host_ok(void) {
1112
1213int main ()
1314{ host_ok ();
14- __bf16 var; // expected-note {{'var' defined here}}
15+ __bf16 var;
1516 kernel<class variables >([=]() {
16- (void )var; // expected-error {{'var' requires 16 bit size '__bf16' type support, but target 'spir64' does not support it}}
17+ (void )var;
1718 int B = sizeof (__bf16);
1819 });
1920
You can’t perform that action at this time.
0 commit comments