Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 13 additions & 11 deletions proposals/0029-cooperative-vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ this should give a sense of how these new operations can be used.
> NOTE: see proposal [0031] for full details on the HLSL API.

```c++
ByteAddressBuffer inputMatrix0;
ByteAddressBuffer inputMatrix1;
ByteAddressBuffer biasVector0;
ByteAddressBuffer biasVector1;
ByteAddressBuffer inputMatrix0; // note read-only buffer
ByteAddressBuffer inputMatrix1; // note read-only buffer
ByteAddressBuffer biasVector0; // note read-only buffer
ByteAddressBuffer biasVector1; // note read-only buffer
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think one comment at the top of the block pointing out that they are all read-only buffers is sufficient.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Honestly since ByteAddressBuffer is already a read only buffer I don't think any of these comments are needed. Its belaboring the point


void ps_main(args) // args: texture, normal, position
{
Expand Down Expand Up @@ -229,9 +229,11 @@ an unsigned integer.

##### Matrix

The matrix is loaded from a raw-buffer, **matrix resource**, starting at
**matrix offset**. The **matrix interpretation** argument specifies the element
type of the matrix (see [Type Interpretations]), no conversion is performed.
The matrix is loaded from a read-only raw-buffer, **matrix resource**, starting
at **matrix offset**. The **matrix interpretation** argument specifies the
element type of the matrix (see [Type Interpretations]), no conversion is
performed.

The **matrix M dimension** and **matrix K dimension** arguments specify the
dimensions of the matrix. The **matrix layout** argument specifies the layout
of the matrix (see [Matrix Layouts]). If the **matrix transpose** is non-zero
Expand All @@ -255,10 +257,10 @@ the matrix load is out of bounds then the entire operation is undefined.

##### Bias Vector

The bias vector is loaded from the raw-buffer, **bias vector resource**,
starting at **bias vector offset**. The **bias vector interpretation** argument
specifies the element type of the bias vector (see [Type Interpretations]), no
conversion is performed.
The bias vector is loaded from the read-only raw-buffer, **bias vector
resource**, starting at **bias vector offset**. The **bias vector
interpretation** argument specifies the element type of the bias vector (see
[Type Interpretations]), no conversion is performed.

Only non-packed interpretations are valid for bias vectors.

Expand Down
9 changes: 7 additions & 2 deletions proposals/0031-hlsl-vector-matrix-operations.md
Original file line number Diff line number Diff line change
Expand Up @@ -459,7 +459,10 @@ InterpretedVector<T, N, DT> MakeInterpretedVector(vector<T, N> Vec) {
### Function: Mul

The `dx::linalg::Mul` function performs a matrix-vector multiplication. The
matrix is stored in memory, while the vector comes from a variable.
matrix is stored in memory, while the vector comes from a variable. The Mul
function expects the memory backing the matrix object to be read-only
(for efficient loads and hardware optimizations) and, therefore, the matrix
must be of MatrixRef type (and not RWMatrixRef type).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I expected this to result in changing the interface of these functions so they take MatrixRef and not MatrixRefImpl.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed.


> TODO: add an example for packed types, and make sure they work correctly

Expand Down Expand Up @@ -530,7 +533,9 @@ Mul(MatrixRefImpl<MatrixBufferTy, MatrixDT, MatrixM, MatrixK, MatrixLayout,
## Function: MulAdd

The `dx::linalg::MulAdd` function behaves as `dx::linalg::Mul`, but also adds a
bias vector (loaded from memory) to the result.
bias vector (loaded from memory) to the result. Similar to the the matrix
operand, the memory backing the bias vector must be read-only, and therefore an
object of `VectorRef` type (and not `RWVectorRef` type).
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As above except without the ability to specify RWVectorRef here, the type is not needed at all.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


Example:

Expand Down
Loading