Skip to content

[0035] Alignment guarantee for Matrix Base, Offset, Stride and Size #839

@anupamachandra

Description

@anupamachandra

Which document does this relate to?
https://github.com/microsoft/hlsl-specs/blob/main/proposals/0035-linalg-matrix.md

Describe the issue you see with the spec
Alignment guarantees for Matrix and Vector Accumulate buffers missing in the linAlg spec.

Additional context
In the earlier cooperative-vector spec buffers had the following alignment guarantees:

Matrix Buffer(for Mul/MulAdd/OuterProduct):
The matrix base address and offset guaranteed to be aligned to at least 128 bytes, and the matrix stride is guaranteed to be aligned to at least 16 bytes and the matrix size was guaranteed to be a multiple of 16 bytes ensuring that the *16 bytes access of the last row/column of the matrix is valid memory.

OutputArray (Vector Accumulate):
The base address and output array offset must be 64 byte aligned. Also note that the size of the underlying allocation is guaranteed to be a multiple of 16 bytes, ensuring that there is valid memory between the end of the array and the 16 byte boundary. Implementations may write to the contents of the padding between the end of the matrix and the 16 byte boundary, so developers should not use this padding space for anything else.

This allows for efficient martrix loads/stores and cases where implementations might require padding the data due to h/w constraints. This guanratee is missing in the current linAlg spec. What we have in its place are align parameters for the relevant HLSL/DXIL ops, while this can be used by users to inform the driver/compiler of the alignment in conjuction with proper allocation of these resources.. just having the restrictions from the older spec without the flexibility seems adequate for most uses, provides portable performance and is sufficiently futureproof.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions