@@ -62,30 +62,23 @@ They have multiple implicit features that need to map to different SPIR-V:
62
62
start and stop the critical region.
63
63
64
64
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:
66
67
67
68
```
68
69
target("spirv.VulkanBuffer", ElementType, StorageClass, IsWriteable, IsROV)
69
70
```
70
71
71
72
` ElementType ` is the type for the storage buffer array, and ` StorageClass ` is
72
73
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.
76
75
77
76
In the SPIR-V backend, there will be a legalization pass that will lower the
78
77
` spirv.VulkanBuffer ` type to code closer to the SPIR-V to be generated:
79
78
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
84
80
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
89
82
` @llvm.spv.resource.getpointer ` will be surrounded by instructions to begin
90
83
and end the critical region.
91
84
@@ -115,7 +108,7 @@ and that the structs have the correct explicit padding for this to be correct.
115
108
All of these resource types are represented using an image type in SPIRV. The
116
109
` Texture* ` types are implemented as sampled images. The ` RWTexture* ` types are
117
110
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.
119
112
120
113
For these cases the return type from ` @llvm.spv.handle.fromBinding ` would be the
121
114
image type matching the resource type:
139
132
Otherwise, the image format for those resource types will be determined by the
140
133
template type ` T ` , and will match the existing behaviour implemented in DXC.
141
134
142
- Note that this creates disconnect with the
135
+ Note that this creates a disconnect with the
143
136
[ Universal Validation Rules] ( https://registry.khronos.org/SPIR-V/specs/unified1/SPIRV.html#_universal_validation_rules ) .
144
137
Specifically,
145
138
@@ -280,4 +273,11 @@ Vulkan 1.3 and later. We could potentially use unknown for all resource types.
280
273
We need to assess if there is any advantage to specifying a particular format.
281
274
If no advantage exists, then we should not attempt to support specific formats.
282
275
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
+
283
283
<!-- {% endraw %} -->
0 commit comments