Skip to content

Commit 07b80a7

Browse files
committed
Create SPV_INTEL_joint_matrix.asciidoc
1 parent 9c2acd9 commit 07b80a7

File tree

1 file changed

+338
-0
lines changed

1 file changed

+338
-0
lines changed
Lines changed: 338 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,338 @@
1+
:extension_name: SPV_INTEL_joint_matrix
2+
:capability_name: JointMatrixINTEL
3+
:capability_token: 6118
4+
:OpTypeJointMatrixINTEL_token: 6119
5+
:OpJointMatrixLoadINTEL_token: 6120
6+
:OpJointMatrixStoreINTEL_token: 6121
7+
:OpJointMatrixMadINTEL_token: 6122
8+
9+
{extension_name}
10+
================
11+
12+
13+
== Name Strings
14+
15+
{extension_name}
16+
17+
== Contact
18+
19+
To report problems with this extension, please open a new issue at:
20+
21+
https://github.com/intel/llvm
22+
23+
== Contributors
24+
25+
- Alexey Sotkin, Intel +
26+
- Dounia Khaldi, Intel +
27+
- Mateusz, Belicki Intel +
28+
29+
== Notice
30+
31+
Copyright (c) 2021 Intel Corporation. All rights reserved.
32+
33+
== Status
34+
35+
Working Draft
36+
37+
This is a preview extension specification, intended to provide early access to a
38+
feature for review and community feedback. When the feature matures, this
39+
specification may be released as a formal extension.
40+
41+
42+
Because the interfaces defined by this specification are not final and are
43+
subject to change they are not intended to be used by shipping software
44+
products. If you are interested in using this feature in your software product,
45+
please let us know!
46+
47+
== Version
48+
49+
[width="40%",cols="25,25"]
50+
|========================================
51+
| Last Modified Date | {docdate}
52+
| Revision | A
53+
|========================================
54+
55+
== Dependencies
56+
57+
This extension is written against the SPIR-V Specification,
58+
Version 1.5 Revision 5.
59+
60+
This extension requires SPIR-V 1.0.
61+
62+
== Overview
63+
64+
This extension adds a type and instructions for joint matrices. Such matrices
65+
are shared among a group of work items and is not private to each work item.
66+
The type introduced with this extension allows to specify memory scope and
67+
layout of the matrix, including layouts optimized for particular hardware(AMX) .
68+
New instructions also allow to specify synchronization scope.
69+
70+
== Extension Name
71+
72+
73+
To use this extension within a SPIR-V module, the appropriate *OpExtension* must
74+
be present in the module:
75+
76+
[subs="attributes"]
77+
----
78+
OpExtension "{extension_name}"
79+
----
80+
81+
== New Capabilities
82+
83+
This extension introduces new capabilities:
84+
85+
[subs="attributes"]
86+
----
87+
{capability_name}
88+
----
89+
90+
== New Instructions
91+
92+
Instructions added under the *{capability_name}* capability:
93+
94+
----
95+
96+
OpTypeJointMatrixINTEL
97+
OpJointMatrixLoadINTEL
98+
OpJointMatrixStoreINTEL
99+
OpJointMatrixMADINTEL
100+
101+
----
102+
103+
== Token Number Assignments
104+
105+
[width="40%"]
106+
[cols="70%,30%"]
107+
[grid="rows"]
108+
|====
109+
|*{capability_name}* | {capability_token}
110+
|*OpTypeJointMatrixINTEL* | {OpTypeJointMatrixINTEL_token}
111+
|*OpJointMatrixLoadINTEL* | {OpJointMatrixLoadINTEL_token}
112+
|*OpJointMatrixStoreINTEL* | {OpJointMatrixStoreINTEL_token}
113+
|*OpJointMatrixMadINTEL* | {OpJointMatrixMadINTEL_token}
114+
|====
115+
116+
== Modifications to the SPIR-V Specification, Version 1.5
117+
118+
=== Matrix layout
119+
120+
Add section 3.XX, Matrix layout.
121+
122+
[options="header"]
123+
|====
124+
2+^| Layout ^| Enabling capability
125+
| 0 | *ColumnMajor* | *{capability_name}*
126+
| 1 | *RowMajor* | *{capability_name}*
127+
| 2 | *PackedA* +
128+
Suitable for VNNI instructions | *{capability_name}*
129+
| 3 | *PackedB* +
130+
Suitable for VNNI instructions | *{capability_name}*
131+
|====
132+
133+
=== Capabilities
134+
135+
Modify Section 3.31, Capability, adding rows to the Capability table:
136+
137+
--
138+
[options="header"]
139+
|====
140+
2+^| Capability ^| Implicitly Declares
141+
| {capability_token} | *{capability_name}*
142+
| Reserved. +
143+
+
144+
See also extension: *{extension_name}*
145+
|====
146+
--
147+
148+
=== Instructions
149+
150+
==== 3.37.6 Type-Declaration Instructions
151+
152+
[cols="1,1,6*3",width="100%"]
153+
|=====
154+
7+|[[OpTypeJointMatrixINTEL]]*OpTypeJointMatrixINTEL* +
155+
+
156+
Declare a matrix type. +
157+
+
158+
'Component Type' is the type of each component in the resulting type. It must be
159+
a scalar 'numerical type'. +
160+
+
161+
'Row Count' is the number of rows in the matrix type. It must be a constant
162+
unsigned 32-bit integer. Behavior is undefined when 'Row Count' is 0 or
163+
<<OpConstantNull,*OpConstantNull*>>. +
164+
+
165+
'Column Count' is the number of columns in the matrix type. It must be a
166+
constant unsigned 32-bit integer. Behavior is undefined when 'Column Count' is
167+
0 or <<OpConstantNull,*OpConstantNull*>>. +
168+
+
169+
'Layout' indicates how the values are arranged internally in the matrix type.
170+
It must be the result of a constant instruction. +
171+
+
172+
'Scope' is memory scope for operations on the matrix. It must be the
173+
result of a constant instruction with scalar 'integer type'. +
174+
175+
176+
1+|Capability: +
177+
*{capability_name}*
178+
1+| 7 | {OpTypeJointMatrixINTEL_token}
179+
| 'Result <id>'
180+
| '<id>' +
181+
'Component Type'
182+
| '<id>' +
183+
'Row Count'
184+
| '<id>' +
185+
'Column Count'
186+
| '<id>' +
187+
'Layout'
188+
| '<id>' +
189+
'Scope'
190+
|=====
191+
192+
193+
==== 3.37.8. Memory Instructions
194+
195+
[cols="1,1,7*3",width="100%"]
196+
|=====
197+
8+|[[OpJointMatrixLoadINTEL]]*OpJointMatrixLoadINTEL* +
198+
+
199+
Load a matrix through a pointer. +
200+
+
201+
'Result Type' is the type of the loaded matrix. It must be
202+
<<OpTypeJointMatrixINTEL,OpTypeJointMatrixINTEL>>. +
203+
+
204+
'Pointer' is the pointer to load through. It specifies start of memory region
205+
where elements of the matrix are stored and arranged according to 'Layout'. +
206+
+
207+
'Stride' is the number of elements in memory between beginnings of successive
208+
rows, columns (or words) in the result. It must be a scalar integer type. +
209+
+
210+
'Layout' indicates how the values loaded from memory are arranged.
211+
It must be the result of a constant instruction. +
212+
+
213+
'Scope' is syncronization scope for operation on the matrix. It must be the
214+
result of a constant instruction with scalar 'integer type'. +
215+
+
216+
If present, any 'Memory Operands' must begin with a
217+
<<Memory_Operands,*memory operand*>> literal. If not present, it is the same as
218+
specifying the <<Memory_Operands,*memory operand*>> *None*. +
219+
220+
1+|Capability: +
221+
*{capability_name}*
222+
1+| 7 + variable | {OpJointMatrixLoadINTEL_token}
223+
| '<id>' +
224+
'Result Type'
225+
|'Result <id>'
226+
| '<id>' +
227+
'Pointer'
228+
| '<id>' +
229+
'Stride'
230+
| '<id>' +
231+
'<<Matrix Layout,Layout>>'
232+
| '<id>' +
233+
'Scope'
234+
| Optional +
235+
'Memory Access'
236+
|=====
237+
238+
239+
[cols="1,1,6*3",width="100%"]
240+
|=====
241+
7+|[[OpJointMatrixStoreINTEL]]*OpJointMatrixStoreINTEL* +
242+
+
243+
Store a matrix through a pointer. +
244+
+
245+
'Pointer' is the pointer to store through. It specifies start of memory region
246+
where elements of the matrix must be stored and arranged according to 'Layout'. +
247+
+
248+
'Object' is the matrix to store. It must be
249+
<<OpTypeJointMatrixINTEL,*OpTypeJointMatrixINTEL*>>. +
250+
+
251+
'Stride' is the number of elements in memory between beginnings of successive
252+
rows, columns (or words) of the 'Object'. It must be a scalar integer type. +
253+
+
254+
'Layout' indicates how the values stored to memory are arranged. It must be the
255+
result of a constant instruction. +
256+
+
257+
'Scope' is syncronization scope for operation on the matrix. It must be the
258+
result of a constant instruction with scalar 'integer type'. +
259+
+
260+
If present, any 'Memory Operands' must begin with a
261+
<<Memory_Operands,*memory operand*>> literal. If not present, it is the same as
262+
specifying the <<Memory_Operands,*memory operand*>> *None*. +
263+
264+
1+|Capability: +
265+
*{capability_name}*
266+
1+| 6 + variable | {OpJointMatrixStoreINTEL_token}
267+
| '<id>' +
268+
'Pointer'
269+
| '<id>' +
270+
'Object'
271+
| '<id>' +
272+
'Stride'
273+
| '<id>' +
274+
'<<Matrix Layout,Layout>>'
275+
| '<id>' +
276+
'Scope'
277+
| Optional +
278+
'Memory Access'
279+
|=====
280+
281+
282+
==== 3.37.13. Arithmetic Instructions
283+
284+
[cols="1,1,6*3",width="100%"]
285+
|=====
286+
7+|[[OpJointMatrixMadINTEL]]*OpJointMatrixMadINTEL* +
287+
+
288+
Multiply matrix 'A' by matrix 'B' and add matrix 'C' to the result of the
289+
multiplication: `A*B+C`. Here 'A' is a `M x K` matrix, 'B' is a `K x N`
290+
matrix and 'C' is a `M x N` matrix. +
291+
+
292+
Behavior is undefined if sizes of operands do not meet the conditions above.
293+
All operands and the 'Ruslt Type' must be
294+
<<OpTypeJointMatrixINTEL,*OpTypeJointMatrixINTEL*>>. +
295+
+
296+
'A' must be a <<OpTypeJointMatrixINTEL,*OpTypeJointMatrixINTEL*>> with
297+
'Rown Count' equals to 'M' and 'Column Count' equals to 'K' +
298+
+
299+
'B' must be a <<OpTypeJointMatrixINTEL,*OpTypeJointMatrixINTEL*>> with
300+
'Rown Count' equals to 'K' and 'Column Count' equals to 'N' +
301+
+
302+
'C' and 'Result Type' must be a
303+
<<OpTypeJointMatrixINTEL,*OpTypeJointMatrixINTEL*>> with 'Rown Count' equals to
304+
'M' and 'Column Count' equals to 'N' +
305+
+
306+
'Scope' is syncronization scope for operation on the matrix. It must be the
307+
result of a constant instruction with scalar 'integer type'. +
308+
309+
1+|Capability: +
310+
*{capability_name}*
311+
1+| 7 | {OpJointMatrixMadINTEL_token}
312+
| '<id>' +
313+
'Result Type'
314+
|'Result <id>'
315+
| '<id>' +
316+
'A'
317+
| '<id>' +
318+
'B'
319+
| '<id>' +
320+
'C'
321+
| '<id>' +
322+
'Scope'
323+
|=====
324+
325+
=== Issues
326+
327+
None
328+
329+
Revision History
330+
----------------
331+
332+
[cols="5,15,15,70"]
333+
[grid="rows"]
334+
[options="header"]
335+
|========================================
336+
|Rev|Date|Author|Changes
337+
|1|2021-02-16|Alexey Sotkin|Initial revision
338+
|========================================

0 commit comments

Comments
 (0)