Skip to content

Commit 0e2d541

Browse files
committed
Add open question about matrices, remove talk of counter_set and counter_binding, and fix a couple minor errors.
1 parent d6c1a3e commit 0e2d541

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

proposals/XXXX-spirv-resource-representation.md

+14-14
Original file line numberDiff line numberDiff line change
@@ -62,30 +62,23 @@ They have multiple implicit features that need to map to different SPIR-V:
6262
start and stop the critical region.
6363

6464
This makes it impossible to create a handle type that maps directly to a SPIR-V
65-
type. To handle this, we will create a target type `spirv.VulkanBuffer`:
65+
type. For now, the counter variable will not be handled. We will create a target
66+
type `spirv.VulkanBuffer` to represent a storage or uniform buffer:
6667

6768
```
6869
target("spirv.VulkanBuffer", ElementType, StorageClass, IsWriteable, IsROV)
6970
```
7071

7172
`ElementType` is the type for the storage buffer array, and `StorageClass` is
7273
the storage class for the array. `IsWriteable` is true if the resource can be
73-
written to, and `IsROV` is true if it is a rasterizer order view. If the
74-
resource has an associated counter variable, its set and binding can be provided
75-
in `CounterSet` and `CounterBinding`.
74+
written to, and `IsROV` is true if it is a rasterizer order view.
7675

7776
In the SPIR-V backend, there will be a legalization pass that will lower the
7877
`spirv.VulkanBuffer` type to code closer to the SPIR-V to be generated:
7978

80-
1. Calls to `@llvm.spv.handle.fromBinding` will be replaced by two calls. One
81-
that returns a handle to the array, and another that return a handle to the
82-
counter, if necessary.
83-
2. Calls to `@llvm.spv.resource.getpointer` will have the handle replaced by
79+
1. Calls to `@llvm.spv.resource.getpointer` will have the handle replaced by
8480
the handle of the array.
85-
3. Calls to `@llvm.spv.resource.updatecounter` will be replaced by a call to
86-
`@llvm.spv.resource.getpointer` with the handle of the counter followed by
87-
an atomic add.
88-
4. If the type of the original handle is rasterizer ordered, all uses of
81+
2. If the type of the original handle is rasterizer ordered, all uses of
8982
`@llvm.spv.resource.getpointer` will be surrounded by instructions to begin
9083
and end the critical region.
9184

@@ -115,7 +108,7 @@ and that the structs have the correct explicit padding for this to be correct.
115108
All of these resource types are represented using an image type in SPIRV. The
116109
`Texture*` types are implemented as sampled images. The `RWTexture*` types are
117110
implemented as storage images. `Buffer` is implemented as a uniform buffer, and
118-
`RWBuffer` is implemented as a storage buffer.
111+
`RWBuffer` is implemented as a storage texel buffer.
119112

120113
For these cases the return type from `@llvm.spv.handle.fromBinding` would be the
121114
image type matching the resource type:
@@ -139,7 +132,7 @@ and
139132
Otherwise, the image format for those resource types will be determined by the
140133
template type `T`, and will match the existing behaviour implemented in DXC.
141134

142-
Note that this creates disconnect with the
135+
Note that this creates a disconnect with the
143136
[Universal Validation Rules](https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_universal_validation_rules).
144137
Specifically,
145138

@@ -280,4 +273,11 @@ Vulkan 1.3 and later. We could potentially use unknown for all resource types.
280273
We need to assess if there is any advantage to specifying a particular format.
281274
If no advantage exists, then we should not attempt to support specific formats.
282275
276+
3. Determine how to add the appropriate decorations for matrices.
277+
278+
If a matrix is part of a storage buffer, it must have an explicit layout with
279+
MatrixStride and either RowMajor or ColMajor decorations. Because matrices are
280+
not yet implemented, we cannot yet determine how these decorations will be
281+
added.
282+
283283
<!-- {% endraw %} -->

0 commit comments

Comments
 (0)