Repository navigation
Add cl_khr_cooperative_matrix OpenCL C extension - #1627
asudarsa-qti wants to merge 9 commits into
Conversation
…invocation update the sizeof operation description for coop matrix (result is total size for entire scope) add saturation modes fix various typos
Signed-off-by: Arvind Sudarsanam <asudarsa@qti.qualcomm.com>
Signed-off-by: Arvind Sudarsanam <asudarsa@qti.qualcomm.com>
|
|
| void coop_mat_store(const gentype *p, component_type __attribute__((coop_mat(...))) m, const coop_matrix_layout_t layout, const size_t _stride); | ||
| component_type __attribute__((coop_mat(...))) coop_mat_mulAdd(component_type __attribute__((coop_mat(...))) A, component_type __attribute__((coop_mat(...))) B, component_type __attribute__((coop_mat(...))) C); | ||
| component_type __attribute__((coop_mat(...))) coop_mat_mulAdd(component_type __attribute__((coop_mat(...))) A, component_type __attribute__((coop_mat(...))) B, component_type __attribute__((coop_mat(...))) C, coop_matrix_operands_t matrix_operands); | ||
| uint coop_mat_length(component_type __attribute__((coop_mat(...))) m); |
There was a problem hiding this comment.
Is coop_mat_init missing from this list?
|
|
||
| [source,c] | ||
| ---- | ||
| component_type __attribute__((coop_mat(...))) coop_mat_load(const gentype p, const coop_matrix_layout_t layout, const size_t stride); |
There was a problem hiding this comment.
Suggesting to manually line-wrap the longer lines here to improve readability.
| === (Add to Section 6.4.3. *Explicit Conversions*) : | ||
|
|
||
| Conversions are allowed between cooperative matrix type only if | ||
| the scope, row, column, and use parameters are the same. |
There was a problem hiding this comment.
Section 6.4.3 says
Explicit conversions may be performed using the
convert_destType(sourceType)suite of functions.
Are we defining any new forms of convert_* here?
There was a problem hiding this comment.
I'm confused, there are 2 files with the same content now?
| == Version | ||
|
|
||
| Built On: {docdate} + | ||
| Version: 1.0.0 |
|
|
||
| [source,c] | ||
| ---- | ||
| __opencl_c_ext_cooperative_matrix |
There was a problem hiding this comment.
| __opencl_c_ext_cooperative_matrix | |
| __opencl_c_khr_cooperative_matrix |
| ---- | ||
|
|
||
| enum coop_matrix_operands_t | ||
| { |
There was a problem hiding this comment.
I think all of the enum values may need a _KHR suffix. And maybe the enums themselves and functions too, though I'm not 100% sure.
| == Dependencies | ||
|
|
||
| This extension is written against the OpenCL 3.0 C Language specification and the OpenCL SPIR-V Environment specification, V3.0.8. | ||
|
|
There was a problem hiding this comment.
Perhaps we should also mention the dependency on cl_khr_cooperative_matrix version 1.0.0 (which brings the API and SPIR-V parts)?
|
|
||
| == Modifications to the OpenCL C Specification | ||
|
|
||
| === (Add a new Section 6.3.X, *Cooperative Matrix Type*) : |
There was a problem hiding this comment.
| === (Add a new Section 6.3.X, *Cooperative Matrix Type*) : | |
| === (Add a new Section 6.3.X, *Cooperative Matrix Types*) : |
| ---- | ||
| coop_mat -> OpTypeCooperativeMatrixKHR | ||
| coop_mat_init(scalar value) -> OpConstantComposite | ||
| coop_mat_init(coop_mat) -> Op*Convert, OpConvert*To* |
There was a problem hiding this comment.
This variant of coop_mat_init isn't explained further down.
| If _layout_ is `CLK_COOPERATIVE_MATRIX_LAYOUT_COLUMN_MAJOR`, | ||
| then elements (*,col) of the result are taken in | ||
| order from contiguous locations starting at _p_ + _col_*_stride_. | ||
| | void **coop_mat_store**(const gentype *_p_, coop_mat _m_, const coop_matrix_layout_t _layout_, const size_t _stride_); |
There was a problem hiding this comment.
| | void **coop_mat_store**(const gentype *_p_, coop_mat _m_, const coop_matrix_layout_t _layout_, const size_t _stride_); | |
| | void **coop_mat_store**(gentype *_p_, coop_mat _m_, const coop_matrix_layout_t _layout_, const size_t _stride_); |
?
| enum coop_matrix_operands_t | ||
| { | ||
| CLK_COOPERATIVE_MATRIX_OPERAND_NONE = 0, | ||
| CLK_COOPERATIVE_MATRIX_OPERAND_MATRIX_A_SIGNED = 0x10, |
There was a problem hiding this comment.
Are we deliberately deviating from the SPV_KHR_cooperative_matrix "Cooperative Matrix Operands" values?
|
|
||
| The arithmetic binary operators add (+), subtract (-), multiply (*), and | ||
| divide (/) operate on cooperative matrix types and perform the operation | ||
| component-wise. The operands must have identical types. |
There was a problem hiding this comment.
Should we say something about uniformity of the operands?
| [cols="7,3",options="header",] | ||
| |==== | ||
| | Function | Description | ||
| | coop_mat **coop_mat_load**(const gentype *_p_, const coop_matrix_layout_t _layout_, const size_t _stride_) |
There was a problem hiding this comment.
This is a "first" for OpenCL I think: the full return type cannot be determined from the arguments/function name. Which means something like coop_mat_length(coop_mat_load(p, layout, stride)) cannot work?
No description provided.