summaryrefslogtreecommitdiffstats
path: root/docs/cuda-target.md
diff options
context:
space:
mode:
authorjsmall-nvidia <jsmall@nvidia.com>2020-01-28 12:41:09 -0500
committerGitHub <noreply@github.com>2020-01-28 12:41:09 -0500
commitb3e0b0d491c55bfdc1c40d26a421910103c1b9f2 (patch)
tree27f58dc4bdf49cd786644adda6d59fbe333a1a4a /docs/cuda-target.md
parent5c6ab6d5198ebff276da9cb8d3024802f22ba9f3 (diff)
Synthesizing CUDA tests (#1183)
* When using setUniform clamp the amount of data written to the buffer size. * CUDA implement StructuredBuffer/ByteAddressBuffer as pointer/count as is on CPU. Allow bounds check to zero index. Update docs. * Synthesize tests. * Fix bug in CUDA output. * Fixing more tests to run on CUDA. * Added BaseType for layout of Vector and Matrix - as they are held as int32_t vector array types. * Enable unbound array support on CUDA. * Added unsized array support for CUDA documentation.
Diffstat (limited to 'docs/cuda-target.md')
-rw-r--r--docs/cuda-target.md21
1 files changed, 20 insertions, 1 deletions
diff --git a/docs/cuda-target.md b/docs/cuda-target.md
index 01803c145..9c82b1dc9 100644
--- a/docs/cuda-target.md
+++ b/docs/cuda-target.md
@@ -97,7 +97,26 @@ The UniformState and UniformEntryPointParams struct typically vary by shader. Un
## Unsized arrays
-WIP: Not implemented yet.
+Unsized arrays can be used, which are indicated by an array with no size as in `[]`. For example
+
+```
+ RWStructuredBuffer<int> arrayOfArrays[];
+```
+
+With normal 'sized' arrays, the elements are just stored contiguously within wherever they are defined. With an unsized array they map to `Array<T>` which is...
+
+```
+ T* data;
+ size_t count;
+```
+
+Note that there is no method in the shader source to get the `count`, even though on the CUDA target it is stored and easily available. This is because of the behavior on GPU targets
+
+* That the count has to be stored elsewhere (unlike with CUDA)
+* On some GPU targets there is no bounds checking - accessing outside the bound values can cause *undefined behavior*
+* The elements may be laid out *contiguously* on GPU
+
+In practice this means if you want to access the `count` in shader code it will need to be passed by another mechanism - such as within a constant buffer. It is possible in the future support may be added to allow direct access of `count` work across targets transparently.
## Prelude