-
Notifications
You must be signed in to change notification settings - Fork 14.7k
Open
Copy link
Labels
Description
Discovered while running the offload-test-suite.
https://godbolt.org/z/TMEKbMaYP
// RUN: %clang-dxc -T cs_6_5 -enable-16bit-types %s
StructuredBuffer<int16_t4> M0 : register(t0);
StructuredBuffer<int16_t4> A0 : register(t1);
StructuredBuffer<int16_t4> B0 : register(t2);
RWStructuredBuffer<int16_t4> Out0 : register(u3);
[numthreads(1,1,1)]
void main() {
Out0[0] = mad(M0[0], A0[0], B0[0]);
}
# .---command stderr------------
# | error: Cannot create IMad operation: Invalid overload type
# | These should never be used!!!
# | UNREACHABLE executed at E:/llvm-project/llvm/lib/Target/DirectX/DXILWriter/DXILBitcodeWriter.cpp:1025!
The llvm ir shows that the mad instruction %dx.imad.i = tail call <4 x i16> @llvm.dx.imad.v4i16(<4 x i16> %17, <4 x i16> %27, <4 x i16> %37)
is not being scalarized when it should be. This is happening with all bit sizes of int
and uint
.
Fix is to add dx_imad
and dx_umad
here:
llvm-project/llvm/lib/Target/DirectX/DirectXTargetTransformInfo.cpp
Lines 58 to 59 in 64eba6e
case Intrinsic::dx_wave_reduce_usum: | |
return true; |
Metadata
Metadata
Assignees
Labels
Type
Projects
Status
Active