Skip to content

Commit ddced5b

Browse files
authored
[0035] Always set align to 128 (#854)
The minimum common alignment is 128 and internal discussion landed on that also likely being the largest useful value. At least for preview, always set that value in the header. We can reevaluate in the future but we are leaning on not changing the DXIL op so the value can be easily updated.
1 parent eb17de2 commit ddced5b

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

proposals/0035-linalg-matrix.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -105,10 +105,10 @@ class Matrix {
105105
Splat(T Val);
106106

107107
static Matrix Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
108-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType));
108+
MatrixLayoutEnum Layout, uint Align = 128);
109109

110110
static Matrix Load(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
111-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType));
111+
MatrixLayoutEnum Layout, uint Align = 128);
112112

113113
template <typename T, SIZE_TYPE Size>
114114
static typename hlsl::enable_if<hlsl::is_arithmetic<T>::value &&
@@ -138,7 +138,7 @@ class Matrix {
138138
Set(uint Index, ElementType Value);
139139

140140
void Store(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
141-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType));
141+
MatrixLayoutEnum Layout, uint Align = 128);
142142

143143
template <typename T, SIZE_TYPE Size>
144144
typename hlsl::enable_if<hlsl::is_arithmetic<T>::value &&
@@ -153,7 +153,7 @@ class Matrix {
153153
void>::type
154154
InterlockedAccumulate(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
155155
MatrixLayoutEnum Layout,
156-
uint Align = sizeof(ElementType));
156+
uint Align = 128);
157157

158158
template <typename T, MatrixUseEnum UseLocal = Use,
159159
MatrixScopeEnum ScopeLocal = Scope, SIZE_TYPE Size>
@@ -194,7 +194,7 @@ class Matrix<ComponentTy, M, N, Use, MatrixScope::Thread> {
194194
static typename hlsl::enable_if<Use == MatrixUse::A && UseLocal == Use,
195195
Matrix>::type
196196
Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
197-
uint Align = sizeof(ElementType));
197+
uint Align = 128);
198198

199199
template <MatrixUseEnum UseLocal = Use>
200200
typename hlsl::enable_if<Use == MatrixUse::Accumulator && UseLocal == Use,
@@ -805,12 +805,12 @@ Matrix::Splat(WaveReadLaneFirst(Val));
805805
```c++
806806
static Matrix Matrix::Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
807807
MatrixLayoutEnum Layout,
808-
uint Align = sizeof(ElementType));
808+
uint Align = 128);
809809

810810
// Not available on Thread scope matrices.
811811
static Matrix Matrix::Load(RWByteAddressBuffer Res, uint StartOffset,
812812
uint Stride, MatrixLayoutEnum Layout,
813-
uint Align = sizeof(ElementType));
813+
uint Align = 128);
814814

815815
// Not available on Thread scope matrices.
816816
template <typename T, SIZE_TYPE Size>
@@ -929,7 +929,7 @@ then the operation is a no-op.
929929
```c++
930930
void Matrix::Store(
931931
RWByteAddressBuffer Res, uint StartOffset, uint Stride, MatrixLayout Layout,
932-
uint Align = sizeof(__detail::ComponentTypeTraits<ComponentTy>::Type));
932+
uint Align = 128);
933933
934934
template <typename T, SIZE_TYPE Size>
935935
typename hlsl::enable_if<hlsl::is_arithmetic<T>::value &&
@@ -972,7 +972,7 @@ typename hlsl::enable_if<Use == MatrixUse::Accumulator && UseLocal == Use,
972972
void>::type
973973
Matrix::InterlockedAccumulate(RWByteAddressBuffer Res, uint StartOffset,
974974
uint Stride, MatrixLayoutEnum Layout,
975-
uint Align = sizeof(ElementType));
975+
uint Align = 128);
976976

977977
template <typename T, MatrixUseEnum UseLocal = Use,
978978
MatrixScopeEnum ScopeLocal = Scope, SIZE_TYPE Size>
@@ -1986,10 +1986,10 @@ class Matrix {
19861986
Splat(T Val);
19871987

19881988
static Matrix Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
1989-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType));
1989+
MatrixLayoutEnum Layout, uint Align = 128);
19901990

19911991
static Matrix Load(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
1992-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType));
1992+
MatrixLayoutEnum Layout, uint Align = 128);
19931993

19941994
template <typename T, SIZE_TYPE Size>
19951995
static typename hlsl::enable_if<hlsl::is_arithmetic<T>::value &&
@@ -2019,7 +2019,7 @@ class Matrix {
20192019
Set(uint Index, ElementType Value);
20202020

20212021
void Store(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
2022-
MatrixLayoutEnum Layout, uint Align = sizeof(ElementType));
2022+
MatrixLayoutEnum Layout, uint Align = 128);
20232023

20242024
template <typename T, SIZE_TYPE Size>
20252025
typename hlsl::enable_if<hlsl::is_arithmetic<T>::value &&
@@ -2034,7 +2034,7 @@ class Matrix {
20342034
void>::type
20352035
InterlockedAccumulate(RWByteAddressBuffer Res, uint StartOffset, uint Stride,
20362036
MatrixLayoutEnum Layout,
2037-
uint Align = sizeof(ElementType));
2037+
uint Align = 128);
20382038

20392039
template <typename T, MatrixUseEnum UseLocal = Use,
20402040
MatrixScopeEnum ScopeLocal = Scope, SIZE_TYPE Size>
@@ -2075,7 +2075,7 @@ class Matrix<ComponentTy, M, N, Use, MatrixScope::Thread> {
20752075
static typename hlsl::enable_if<Use == MatrixUse::A && UseLocal == Use,
20762076
Matrix>::type
20772077
Load(ByteAddressBuffer Res, uint StartOffset, uint Stride,
2078-
uint Align = sizeof(ElementType));
2078+
uint Align = 128);
20792079

20802080
template <MatrixUseEnum UseLocal = Use>
20812081
typename hlsl::enable_if<Use == MatrixUse::Accumulator && UseLocal == Use,

0 commit comments

Comments
 (0)