Skip to content

Commit e05e82b

Browse files
authored
[SPIR-V][DOC] Add SPV_INTEL_bfloat16_arithmetic extension specification (#18352)
The extension is based on the SPV_KHR_bfloat16 extension and adds support for arithmetic and logical operations on bfloat16 types.
1 parent ef5bfb8 commit e05e82b

File tree

1 file changed

+145
-0
lines changed

1 file changed

+145
-0
lines changed
Lines changed: 145 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,145 @@
1+
:extension_name: SPV_INTEL_bfloat16_arithmetic
2+
:capability_name: BFloat16ArithmeticINTEL
3+
:capability_token: 6226
4+
:dep_ext_name: SPV_KHR_bfloat16
5+
:dep_ext_rev: 1
6+
:dep_ext_capability: BFloat16TypeKHR
7+
8+
= {extension_name}
9+
10+
== Name Strings
11+
12+
{extension_name}
13+
14+
== Contact
15+
16+
To report problems with this extension, please open a new issue at:
17+
18+
https://github.com/intel/llvm
19+
20+
== Contributors
21+
22+
* Ben Ashbaugh, Intel
23+
* Victor Mustya, Intel
24+
25+
== Notice
26+
27+
Copyright (c) 2025 Intel Corporation. All rights reserved.
28+
29+
== Status
30+
31+
* Working Draft
32+
33+
This is a preview extension specification, intended to provide early access to
34+
a feature for review and community feedback. When the feature matures, this
35+
specification may be released as a formal extension.
36+
37+
Because the interfaces defined by this specification are not final and are
38+
subject to change they are not intended to be used by shipping software
39+
products. If you are interested in using this feature in your software product,
40+
please let us know!
41+
42+
== Version
43+
44+
[width="40%",cols="25,25"]
45+
|========================================
46+
| Last Modified Date | {docdate}
47+
| Revision | 1
48+
|========================================
49+
50+
== Dependencies
51+
52+
This extension is written against the SPIR-V Specification, Version 1.6 Revision
53+
5, and `{dep_ext_name}`, Revision {dep_ext_rev}.
54+
55+
This extension requires SPIR-V 1.0 and `{dep_ext_name}`, Revision {dep_ext_rev}.
56+
57+
== Overview
58+
59+
This extension allows to use *OpTypeFloat* instruction to define *BFloat16KHR*
60+
data type and use it for all the floating-point insructions.
61+
62+
== Extension Name
63+
64+
To use this extension within a SPIR-V module, the following *OpExtension* must
65+
be present in the module:
66+
67+
[subs="attributes"]
68+
----
69+
OpExtension "{extension_name}"
70+
----
71+
72+
== Modifications to the SPIR-V Specification, Version 1.6
73+
74+
=== Validation Rules
75+
76+
Add validation rules to section 2.16.1 Universal Validation Rules from:
77+
78+
* Variables with a type that is or includes a floating-point type with the
79+
*BFloat16KHR* encoding must only be used with the following instructions,
80+
if *{capability_name}* is declared:
81+
82+
** https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_mode_setting_instructions[Arithmetic Instructions]:
83+
84+
*** *OpFNegate*
85+
*** *OpFAdd*
86+
*** *OpFSub*
87+
*** *OpFMul*
88+
*** *OpFDiv*
89+
*** *OpFRem*
90+
*** *OpFMod*
91+
*** *OpVectorTimesScalar*
92+
93+
** https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_relational_and_logical_instructions[Relational and Logical Instructions]
94+
95+
* Variables with a type that is or includes a floating-point type with the
96+
*BFloat16KHR* encoding can be used with *OpExtInst* instruction with the
97+
opcodes from the https://registry.khronos.org/SPIR-V/specs/unified1/OpenCL.ExtendedInstructionSet.100.html[OpenCL extended instruction set].
98+
99+
=== Capabilities
100+
101+
Modify Section 3.31, "Capability", adding these rows to the Capability table:
102+
103+
--
104+
[cols="^.^2,16,15",options="header"]
105+
|====
106+
2+^.^| Capability | Implicitly Declares
107+
| {capability_token} | *{capability_name}* +
108+
Allows *OpTypeFloat* with the *BFloat16KHR* <<Floating_Point_Encoding, floating point encoding>>
109+
to be used with arithmetic instructions.
110+
| *{dep_ext_capability}*
111+
|====
112+
--
113+
114+
== Interactions with Other Extensions
115+
116+
If `SPV_INTEL_masked_gather_scatter` is supported then *OpMaskedGatherINTEL*
117+
and *OpMaskedGatherINTEL* also accept vector of *BFloat16KHR* and vector of
118+
pointers to *BFloat16KHR*.
119+
120+
== Issues
121+
122+
. Should the extension be INTEL or EXT/KHR?
123+
+
124+
--
125+
*UNRESOLVED*: The functionality is generic, so it probably may be useful for
126+
non-Intel implementations.
127+
--
128+
129+
. Should we define *BFloat16* atomics and interaction with
130+
`SPV_EXT_shader_atomic_float_min_max` and `SPV_EXT_shader_atomic_float_add`
131+
by this extension?
132+
+
133+
--
134+
*RESOLVED*: The atomic operations should be defined by a separate extension.
135+
--
136+
137+
== Revision History
138+
139+
[cols="5,15,15,70"]
140+
[grid="rows"]
141+
[options="header"]
142+
|========================================
143+
|Rev|Date|Author|Changes
144+
|1|2025-05-07|Victor Mustya|Initial public revision
145+
|========================================

0 commit comments

Comments
 (0)