Skip to content

[0029] Rename API call ConvertLinearAlgebraMatrix to ConvertLinearAlgebraMatrices #514

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
45 changes: 30 additions & 15 deletions proposals/0029-cooperative-vector.md
Original file line number Diff line number Diff line change
Expand Up @@ -586,7 +586,7 @@ enum class DXILMatrixLayout : uint {
```

Optimal layouts are opaque implementation specific layouts, the D3D call
`ConvertLinearAlgebraMatrix` can be used to convert the *Matrix* to an optimal
`ConvertLinearAlgebraMatrices` can be used to convert the matrices to an optimal
layout. Row-Major and Column-Major layouts are also supported. **matrix
stride** must be zero for optimal layouts.

Expand Down Expand Up @@ -872,11 +872,13 @@ typedef struct D3D12_LINEAR_ALGEBRA_MATRIX_CONVERSION_DEST_INFO {
// the destination layout information and does not depend on the source layout
// information.

void ID3D12DevicePreview::GetLinearAlgebraMatrixConversionDestinationInfo(
void ID3D12DeviceNN::GetLinearAlgebraMatrixConversionDestinationInfo(
D3D12_LINEAR_ALGEBRA_MATRIX_CONVERSION_DEST_INFO* pDesc);

```

> Note: NN will be replaced with the actual number suffix when implemented.

#### Conversion descriptors

After the size of the destination buffer is known, user can pass the
Expand Down Expand Up @@ -932,28 +934,41 @@ number of bytes returned in call to

```c++
// Converts source matrix to desired layout and datatype
void ID3D12GraphicsCommandListPreview::ConvertLinearAlgebraMatrix(
void ID3D12GraphicsCommandListNN::ConvertLinearAlgebraMatrices(
D3D12_LINEAR_ALGEBRA_MATRIX_CONVERSION_INFO* pDesc,
UINT DescCount);

```

> Note: NN will be replaced with the actual number suffix when implemented.
> Also note the name change from `ConvertLinearAlgebraMatrix` to
`ConvertLinearAlgebraMatrices` to more accurately reflect that multiple
matrices maybe transformed in one call.

*Valid Usage:*

* If SrcLayout is row-major or column-major, then SrcStride should be greater than the length of a row/column, and a
multiple of the element size.
* If DestLayout is row-major or column-major, then DestStride should be greater than the length of a row/column, and a
multiple of 16.
* If SrcComponentType is not a supported MatrixInterpretation value as reported by CheckFeatureSupport() then
SrcComponentType should be `D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT32`.
* If DestComponentType is not a supported MatrixInterpretation value as reported by CheckFeatureSupport() then
DestComponentType should be `D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT32`.
* If SrcComponentType and DestComponentType are not equal, then one should be `D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT32` or `D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT16` and the other should be a lower-precision floating-point type.
* If DestComponentType is `D3D12_LINEAR_ALGEBRA_DATATYPE_E4M3` or `D3D12_LINEAR_ALGEBRA_DATATYPE_E5M2`, then DestLayout should be `D3D12_LINEAR_ALGEBRA_MATRIX_LAYOUT_MUL_OPTIMAL` or `D3D12_LINEAR_ALGEBRA_MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL`.
* If SrcLayout is row-major or column-major, then SrcStride must be greater
than the length of a row/column, and a multiple of the element size.
* If DestLayout is row-major or column-major, then DestStride must be greater
than the length of a row/column, and a multiple of 16.
* If SrcComponentType is not a supported MatrixInterpretation value as reported
by CheckFeatureSupport() then SrcComponentType must be
`D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT32`.
* If DestComponentType is not a supported MatrixInterpretation value as reported
by CheckFeatureSupport() then DestComponentType must be
`D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT32`.
* If SrcComponentType and DestComponentType are not equal, then one must be
`D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT32` or
`D3D12_LINEAR_ALGEBRA_DATATYPE_FLOAT16` and the other must be a
lower-precision floating-point type.
* If DestComponentType is `D3D12_LINEAR_ALGEBRA_DATATYPE_E4M3` or
`D3D12_LINEAR_ALGEBRA_DATATYPE_E5M2`, then DestLayout must be
`D3D12_LINEAR_ALGEBRA_MATRIX_LAYOUT_MUL_OPTIMAL` or
`D3D12_LINEAR_ALGEBRA_MATRIX_LAYOUT_OUTER_PRODUCT_OPTIMAL`.

*CommandList interactions:*

- Synchronization around `ConvertLinearAlgebraMatrix` calls:
- Synchronization around `ConvertLinearAlgebraMatrices` calls:
- Legacy Barrier
- Source buffer: Must be in `D3D12_RESOURCE_STATE_NON_PIXEL_SHADER_RESOURCE` state
- Dest buffer: Must be in `D3D12_RESOURCE_STATE_UNORDERED_ACCESS` state
Expand Down Expand Up @@ -1012,7 +1027,7 @@ pD3D12Device->GetLinearAlgebraMatrixConversionDestinationInfo(&infoDesc.DestInfo
infoDesc.DataDesc.DestVA = srcVA + infoDesc.DestInfo.DestSize;

// Perform the conversion
pD3D12CommandList->ConvertLinearAlgebraMatrix(&infoDesc, 0);
pD3D12CommandList->ConvertLinearAlgebraMatrices(&infoDesc, 0);

```
### D3D12 DDI Additions
Expand Down