Skip to content

Commit f314654

Browse files
committed
Allow vector multiply only for input vectors with arithmetic types unless input type interpretation is provided as a separate argument or in InterpretedVector.
1 parent c63a4b5 commit f314654

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

tools/clang/lib/Headers/hlsl/dx/linalg.h

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,9 @@ Matrix<CompTy, M, N, MatrixUse::Accumulator, MatrixScope::ThreadGroup> Multiply(
391391

392392
template <typename OutputElTy, typename InputElTy, SIZE_TYPE M, SIZE_TYPE K,
393393
ComponentEnum MatrixDT>
394-
vector<OutputElTy, M>
394+
// clang-format off
395+
typename hlsl::enable_if<hlsl::is_arithmetic<InputElTy>::value, vector<OutputElTy, K> >::type
396+
// clang-format on
395397
Multiply(Matrix<MatrixDT, M, K, MatrixUse::B, MatrixScope::Thread> MatrixB,
396398
vector<InputElTy, K> Vec) {
397399
vector<OutputElTy, M> Result;
@@ -402,7 +404,9 @@ Multiply(Matrix<MatrixDT, M, K, MatrixUse::B, MatrixScope::Thread> MatrixB,
402404

403405
template <typename OutputElTy, typename InputElTy, typename BiasElTy,
404406
SIZE_TYPE M, SIZE_TYPE K, ComponentEnum MatrixDT>
405-
vector<OutputElTy, K>
407+
// clang-format off
408+
typename hlsl::enable_if<hlsl::is_arithmetic<InputElTy>::value, vector<OutputElTy, K> >::type
409+
// clang-format on
406410
MultiplyAdd(Matrix<MatrixDT, M, K, MatrixUse::B, MatrixScope::Thread> MatrixB,
407411
vector<InputElTy, M> Vec, vector<BiasElTy, K> Bias) {
408412
vector<OutputElTy, K> Result;
@@ -431,7 +435,9 @@ MultiplyAdd(Matrix<MatrixDT, M, K, MatrixUse::B, MatrixScope::Thread> MatrixB,
431435

432436
template <typename OutputElTy, typename InputElTy, ComponentEnum BiasElTy,
433437
SIZE_TYPE M, SIZE_TYPE K, ComponentEnum MatrixDT>
434-
vector<OutputElTy, K>
438+
// clang-format off
439+
typename hlsl::enable_if<hlsl::is_arithmetic<InputElTy>::value, vector<OutputElTy, K> >::type
440+
// clang-format on
435441
MultiplyAdd(Matrix<MatrixDT, M, K, MatrixUse::B, MatrixScope::Thread> MatrixB,
436442
vector<InputElTy, M> Vec, VectorRef<BiasElTy, K> BiasRef) {
437443
using BiasVecTy =

0 commit comments

Comments
 (0)