Conversation
ext/cl_khr_tensor.asciidoc
Outdated
|
|
||
| === Sample Codes | ||
|
|
||
| Helper functions used in the follow up tensor code samples: |
There was a problem hiding this comment.
Let's first define a couple of helper functions which are used in the tensor usage examples:
ext/cl_khr_tensor.asciidoc
Outdated
| // might not use some of the tensor. | ||
| assert(clEnqueueReadTensor(..., t0, ...) == CL_INVALID_OPERATION); | ||
| ---- | ||
|
|
There was a problem hiding this comment.
The OpenCL C builtins for acessing the tensor metadata needs to be defined (and after that the SPIR-V extensions).
There was a problem hiding this comment.
Could the OpenCL C support for tensors be in a separate extension? I think, there is a lot to be covered.
Built-in kernels should be able to define kernels tensor arguments without the OpenCL C tensor extension.
There was a problem hiding this comment.
Yes. Since this will be useful already for the BiKs, it doesn't require the OpenCL C or SPIR-V counterparts, you're right.
ext/cl_khr_tensor.asciidoc
Outdated
| [[cl_khr_tensor]] | ||
| == Tensor Data Type | ||
|
|
||
| Purpose of this extension is to provide ... |
There was a problem hiding this comment.
"This extension provides a new opaque OpenCL datatype called cl_tensor. It is used for storing N-dimensional tensor data in implementation-optimized way. The datatype is designed to be efficiently used within the cl_khr_command_buffers extension to capture task graphs which can utilize tensors as input, output and temporary storage." [etc etc]
There was a problem hiding this comment.
Added this and tweaked it a little.
bashbaug
left a comment
There was a problem hiding this comment.
Interesting extension! There are some parts of it that we might want to consider refactoring out, since they could be applicable to non-tensor objects also:
- The ability to bind a description of an object to an existing buffer. We already have this slightly, albeit in the other direction, in the form of the "2d image from buffer" extensions.
- The ability to attach "temporary" (or "virtual") objects to a command buffer, that are owned by a command buffer but that do not persist beyond command buffer execution.
ext/cl_khr_tensor.asciidoc
Outdated
|
|
||
| [source,c] | ||
| ---- | ||
| cl_int clEnqueueReadTensor( |
There was a problem hiding this comment.
Presumably these read and write functions are invalid for CL_TENSOR_COMMAND_BUFFER_TEMPORARY tensors?
There was a problem hiding this comment.
Yes and the functions should return CL_INVALID_OPERATION. This is attempted to be stated in CL_MEM_COMMAND_BUFFER_TEMPORARY property description (perhaps it's not clear enough?).
Co-authored-by: Ben Ashbaugh <ben.ashbaugh@intel.com> Co-authored-by: Pekka Jääskeläinen <pekka.jaaskelainen@tuni.fi>
* cl_khr_tensor -> cl_exp_tensor. * Remove cl_khr_command_buffer requirement.
* Fix signed -> unsigned.
* Single line cl{Retain,Release}TensorObject declaration.
…Tensor.
* Clarify in clEnqueue{TranslateFrom,TranslateTo}Tensor that data read
from / written to the tensor in opaque manner.
|
@bashbaug, temporary command buffer object property has been refactored out to be a buffer object property. Would this look good to you? |
This seems like a good direction, yes. A few other things we could consider:
Thanks! |
| which can utilize tensors as input, output and temporary storage. | ||
|
|
||
| === General information | ||
|
|
There was a problem hiding this comment.
Let's write a motivational text here which is interfacing to the DBKs (refer to the WiP spec) on the backend, and to better interface to higher-level models for neural networks and other libraries/formats dealing with tensors.
* new section for tensor data type * add origin, region and pitch parameters for clEnqueueTranslate*Tensor. * Update code samples. * Add take on accessing tensors in OpenCL C.
pjaaskel
left a comment
There was a problem hiding this comment.
Kiitos. Looks good. Please fix these and then submit the PR to the Khronos repo to hopefully get further feedback.
ext/cl_exp_tensor.asciidoc
Outdated
|
|
||
| // TODO: add command buffer variants for clEnqueue{copy,read,write}Tensor. | ||
|
|
||
| TODO: add command buffer variants for clEnqueue*Tensor. |
There was a problem hiding this comment.
Perhaps do this still before sending the Khronos/OpenCL-Docs pull request?
Co-authored-by: Pekka Jääskeläinen <pekka.jaaskelainen@tuni.fi>
* Add error codes for tensor translation commands. * Tweaked mem_pitch semantics.
ext/cl_exp_tensor.asciidoc
Outdated
| given coordinate. The method how the coordinates translate to tensor | ||
| storage addresses is unspecified. | ||
|
|
||
| *clEnqueueTranslateFsomTensor* and *clEnqueueTranslateToTensor* |
There was a problem hiding this comment.
Maybe import/export are even better word here instead of 'translate'?
ext/cl_exp_tensor.asciidoc
Outdated
| // TODO: add clEnqueueFillTensor? | ||
|
|
||
| TODO: add command buffer variants for clEnqueue*Tensor. | ||
| If *cl_khr_command_buffer* is is supported, then the following command |
* Fix typos.
|
Closing. This PR has moved to KhronosGroup#1006. |
No description provided.