Skip to content

Commit 5f04faf

Browse files
committed
Fix the return types of dot4add_i8packed and dot4add_u8packed.
Change the definition of the HLSL `dot4add_i8packed` and `dot4add_u8packed` intrinsics in `utils/hct/gen_intrin_main.txt` to simply spell out the return types, rather than saying that their return type is determined by their third argument. This prevents DXC from trying to give those functions declarations like declare i64 @"\01?dot4add_u8packed@hlsl@@YA_JII_J@Z"(i32, i32, i64 signext) #1 which seems to expect a 64-bit third argument and return value. These functions are not generic, and they have only one overload, so there is no need to use interesting `uComponentTypeId` values to get the right effects, and `HLSLExternalSource::MatchArguments` seems to get confused about how to treat argument types that affect the return types. Fixes microsoft#7400.
1 parent c75bb05 commit 5f04faf

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// RUN: %dxc /Od /T cs_6_8 %s | FileCheck %s
2+
3+
// Compiling this HLSL would fail this assertion in TranslateDot4AddPacked:
4+
//
5+
// DXASSERT(
6+
// !accTy->isVectorTy() && accTy->isIntegerTy(32),
7+
// "otherwise, unexpected vector support in high level intrinsic template");
8+
//
9+
// Bug was fixed by changing the declarations of dot4add_i8packed and
10+
// dot4add_u8packed in utils/hct/gen_intrin_main.txt to simply write
11+
// out their argument and return types, rather than using the $typeN
12+
// reference syntax.
13+
14+
// CHECK: define void @main()
15+
16+
[numthreads(1, 1, 1)]
17+
void main()
18+
{
19+
int c_6_ = dot4add_i8packed(0, 0, 0);
20+
int c7 = dot4add_i8packed(0, 0, c_6_);
21+
}

utils/hct/gen_intrin_main.txt

+2-2
Original file line numberDiff line numberDiff line change
@@ -336,8 +336,8 @@ float<4,3> [[rn]] ObjectToWorld4x3();
336336
float<4,3> [[rn]] WorldToObject4x3();
337337

338338
// Packed dot products with accumulate:
339-
$type3 [[rn]] dot4add_u8packed(in uint a, in $type1 b, in uint c);
340-
$type3 [[rn]] dot4add_i8packed(in uint a, in $type1 b, in int c);
339+
uint [[rn]] dot4add_u8packed(in uint a, in $type1 b, in uint c);
340+
int [[rn]] dot4add_i8packed(in uint a, in $type1 b, in int c);
341341
$type3 [[rn]] dot2add(in float16_t<2> a, in $type1 b, in float c);
342342

343343
// Unpacking intrinsics

0 commit comments

Comments
 (0)