Skip to content

Commit d4cd973

Browse files
committed
[SPIR-V][Doc] Implement SPV_INTEL_complex_float_mul_div extension
1 parent 16e1920 commit d4cd973

File tree

1 file changed

+211
-0
lines changed

1 file changed

+211
-0
lines changed
Lines changed: 211 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,211 @@
1+
:extension_name: SPV_INTEL_complex_float_mul_div
2+
:capability_name: ComplexFloatMulDivINTEL
3+
:capability_token: 6414
4+
:OpComplexFMulINTEL_token: 6415
5+
:OpComplexFDivINTEL_token: 6416
6+
7+
{extension_name}
8+
================
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+
- Nikita Kornev, Intel +
23+
24+
== Notice
25+
26+
Copyright (c) 2022 Intel Corporation. All rights reserved.
27+
28+
== Status
29+
30+
Working Draft
31+
32+
This is a preview extension specification, intended to provide early access to a
33+
feature for review and community feedback. When the feature matures, this
34+
specification may be released as a formal extension.
35+
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 | 2022-03-16
47+
| Revision | 1
48+
|========================================
49+
50+
== Dependencies
51+
52+
This extension is written against the SPIR-V Specification,
53+
Version 1.5 Revision 6.
54+
55+
This extension requires SPIR-V 1.0.
56+
57+
== Overview
58+
59+
This extension adds new capability and instructions to add support for
60+
arithmetic operations with operands of complex type.
61+
62+
== Extension Name
63+
64+
To use this extension within a SPIR-V module, the appropriate *OpExtension* must
65+
be present in the module:
66+
67+
[subs="attributes"]
68+
----
69+
OpExtension "{extension_name}"
70+
----
71+
72+
== New Capabilities
73+
74+
This extension introduces new capabilities:
75+
76+
[subs="attributes"]
77+
----
78+
{capability_name}
79+
----
80+
81+
== New Instructions
82+
83+
Instructions added under the *{capability_name}* capability:
84+
85+
----
86+
87+
OpComplexFMulINTEL
88+
OpComplexFDivINTEL
89+
90+
----
91+
92+
== Token Number Assignments
93+
94+
[width="40%"]
95+
[cols="70%,30%"]
96+
[grid="rows"]
97+
|====
98+
|*{capability_name}* | {capability_token}
99+
|*OpComplexFMulINTEL* | {OpComplexFMulINTEL_token}
100+
|*OpComplexFDivINTEL* | {OpComplexFDivINTEL_token}
101+
102+
|====
103+
104+
== Modifications to the SPIR-V Specification, Version 1.5, revision 6
105+
106+
=== Capabilities
107+
108+
Modify Section 3.31, Capability, adding rows to the Capability table:
109+
110+
--
111+
[options="header"]
112+
|====
113+
2+^| Capability ^| Implicitly Declares
114+
| {capability_token} | *{capability_name}*
115+
| Reserved. +
116+
+
117+
See also extension: *{extension_name}*
118+
|====
119+
--
120+
121+
=== Instructions
122+
123+
==== 3.42.13. Arithmetic Instructions
124+
125+
[cols="6*",width="100%"]
126+
|=====
127+
5+| *OpComplexFMulINTEL* +
128+
+
129+
Complex multiplication of 'Operand 1' and 'Operand 2'. +
130+
+
131+
'Result Type' must be a vector of floating-point type of length divisible by 2. +
132+
If the length is 2, the first component is the real part and the second
133+
component is the imaginary part. +
134+
If the length is greater than 2, then the first component is the real part of
135+
the first complex number of the vector and the second component is the imaginary
136+
part of the first complex number of the vector. The third component is the real
137+
part of the second complex number of the vector and the fourth component is the
138+
imaginary part of the second complex number of the vector, etc. +
139+
+
140+
The types of 'Operand 1' and 'Operand 2' both must be the same as 'Result Type'.
141+
| Capability: +
142+
*{capability_name}*
143+
144+
| 5
145+
| {OpComplexFMulINTEL_token}
146+
| 'Result Type' +
147+
'<id>'
148+
| 'Result' +
149+
'<id>'
150+
| '<id>' +
151+
'Operand 1'
152+
| '<id>' +
153+
'Operand 2'
154+
|=====
155+
156+
[cols="6*",width="100%"]
157+
|=====
158+
5+| *OpComplexFDivINTEL* +
159+
+
160+
Complex division of 'Operand 1' divided by 'Operand 2'. +
161+
+
162+
'Result Type' must be a vector of floating-point type of length divisible by 2. +
163+
If the length is 2, the first component is the real part and the second
164+
component is the imaginary part. +
165+
If the length is greater than 2, then the first component is the real part of
166+
the first complex number of the vector and the second component is the imaginary
167+
part of the first complex number of the vector. The third component is the real
168+
part of the second complex number of the vector and the fourth component is the
169+
imaginary part of the second complex number of the vector, etc. +
170+
+
171+
The types of 'Operand 1' and 'Operand 2' both must be the same as 'Result Type'.
172+
| Capability: +
173+
*{capability_name}*
174+
175+
| 5
176+
| {OpComplexFDivINTEL_token}
177+
| 'Result Type' +
178+
'<id>'
179+
| 'Result' +
180+
'<id>'
181+
| '<id>' +
182+
'Operand 1'
183+
| '<id>' +
184+
'Operand 2'
185+
|=====
186+
187+
=== Issues
188+
189+
. Do we need to introduce new SPIR-V instructions to represent complex "add",
190+
"sub", "real" and "imag" operations?
191+
+
192+
--
193+
*RESOLVED*
194+
195+
Since the complex number is represented as a vector of two floating-point
196+
values, a complex "add", "sub" are the same as a vector "add" and "sub";
197+
"real" and "imag" complex operations are also represented as a vector
198+
instructions. As long as there is no special LLVM-IR complex type, there is no
199+
need for a special SPIR-V instructions to repesent these operations.
200+
--
201+
202+
Revision History
203+
----------------
204+
205+
[cols="5,15,15,70"]
206+
[grid="rows"]
207+
[options="header"]
208+
|========================================
209+
|Rev|Date|Author|Changes
210+
|1|2022-03-16|Nikita Kornev|Initial revision
211+
|========================================

0 commit comments

Comments
 (0)