Skip to content
Merged
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
5 changes: 4 additions & 1 deletion tools/clang/lib/Headers/hlsl/dx/linalg.h
Original file line number Diff line number Diff line change
Expand Up @@ -186,8 +186,11 @@ __MATRIX_SCALAR_COMPONENT_MAPPING(ComponentType::U64, uint64_t)
__MATRIX_SCALAR_COMPONENT_MAPPING(ComponentType::F64, double)

template <ComponentEnum DstTy, ComponentEnum SrcTy, int SrcN> struct DstN {
// Make sure to round up in case SrcN isn't an even multiple of the number of
// elements per scalar
static const int Value =
(SrcN * ComponentTypeTraits<SrcTy>::ElementsPerScalar) /
(SrcN * ComponentTypeTraits<SrcTy>::ElementsPerScalar +
ComponentTypeTraits<DstTy>::ElementsPerScalar - 1) /
ComponentTypeTraits<DstTy>::ElementsPerScalar;
};

Expand Down
5 changes: 5 additions & 0 deletions tools/clang/test/CodeGenDXIL/hlsl/linalg/api/vectors.hlsl
Original file line number Diff line number Diff line change
Expand Up @@ -82,4 +82,9 @@ void main(uint ID : SV_GroupID) {
half16 srcF16 = BAB.Load<half16>(128);
InterpretedVector<uint, 4, ComponentEnum::F8_E4M3FN> convertedPacked = Convert<ComponentEnum::F8_E4M3FN, ComponentEnum::F16>(srcF16);

// CHECK: call <1 x i32> @dx.op.linAlgConvert.v1i32.v3f16(i32 -2147483618, <3 x half> %25, i32 8, i32 21)
// CHECK-SAME: ; LinAlgConvert(inputVector,inputInterpretation,outputInterpretation)
half3 ThreeF16 = BAB.Load<half3>(256);
InterpretedVector<uint, 1, ComponentEnum::F8_E4M3FN> convertedPacked2 =
Convert<ComponentEnum::F8_E4M3FN, ComponentEnum::F16>(ThreeF16);
}
Loading