Skip to content

Commit 9014b40

Browse files
aratajewigcbot
authored andcommitted
Integrate the bfloat type into BiFModule
Integrate the `bfloat` type into BiFModule
1 parent 5ad198d commit 9014b40

File tree

2 files changed

+14
-0
lines changed

2 files changed

+14
-0
lines changed

IGC/BiFModule/Headers/spirv.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,13 @@ typedef char __bool4 __attribute__((ext_vector_type(4)));
153153
typedef char __bool8 __attribute__((ext_vector_type(8)));
154154
typedef char __bool16 __attribute__((ext_vector_type(16)));
155155

156+
typedef __bf16 bfloat;
157+
typedef bfloat bfloat2 __attribute__((ext_vector_type(2)));
158+
typedef bfloat bfloat3 __attribute__((ext_vector_type(3)));
159+
typedef bfloat bfloat4 __attribute__((ext_vector_type(4)));
160+
typedef bfloat bfloat8 __attribute__((ext_vector_type(8)));
161+
typedef bfloat bfloat16 __attribute__((ext_vector_type(16)));
162+
156163
#define INTEL_PIPE_RESERVE_ID_VALID_BIT (1U << 30)
157164
#define CLK_NULL_RESERVE_ID \
158165
(__builtin_astype(((void *)(~INTEL_PIPE_RESERVE_ID_VALID_BIT)), __spirv_ReserveId))

IGC/BiFModule/Implementation/include/BiF_Definitions.cl

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,6 +132,13 @@ SPDX-License-Identifier: MIT
132132
#define as_double8(x) __builtin_astype((x), double8)
133133
#define as_double16(x) __builtin_astype((x), double16)
134134

135+
#define as_bfloat(x) __builtin_astype((x), bfloat)
136+
#define as_bfloat2(x) __builtin_astype((x), bfloat2)
137+
#define as_bfloat3(x) __builtin_astype((x), bfloat3)
138+
#define as_bfloat4(x) __builtin_astype((x), bfloat4)
139+
#define as_bfloat8(x) __builtin_astype((x), bfloat8)
140+
#define as_bfloat16(x) __builtin_astype((x), bfloat16)
141+
135142
#define ONE_EIGHTY_OVER_PI_DBL (as_double(0x404CA5DC1A63C1F8)) // 57.295779513082320876798154814105
136143
#define ONE_EIGHTY_OVER_PI_FLT (as_float(0x42652EE1)) // 57.295779513082320876798154814105f
137144
#define ONE_EIGHTY_OVER_PI_HLF (as_half((ushort)0x5329)) // 57.295779513082320876798154814105h

0 commit comments

Comments
 (0)