Skip to content

Commit c529455

Browse files
authored
ExecutionTests: Long Vectors - Fix WaveActiveAllEqual for bools (#7932)
Fixes a bug in the WaveActiveAllEqual hlsl test code where we intended to make the last value of the input vector anything but the input value. The logic was broken for bools. Updated by adding helper functions for each possible type to handle accordingly.
1 parent b9d3d10 commit c529455

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

tools/clang/unittests/HLSLExec/ShaderOpArith.xml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4147,11 +4147,26 @@ void MSMain(uint GID : SV_GroupIndex,
41474147
#endif
41484148
41494149
#ifdef FUNC_WAVE_ACTIVE_ALL_EQUAL
4150+
bool MakeDifferent(bool A) { return !A; }
4151+
uint MakeDifferent(uint A) { return A ^ 1; }
4152+
uint64_t MakeDifferent(uint64_t A) { return A ^ 1; }
4153+
int MakeDifferent(int A) { return A ^ 1; }
4154+
int64_t MakeDifferent(int64_t A) { return A ^ 1; }
4155+
half MakeDifferent(half A) { return A + (half)1.0h; }
4156+
float MakeDifferent(float A) { return A + 1.0f; }
4157+
double MakeDifferent(double A) { return A + 1.0; }
4158+
4159+
#if defined(__HLSL_ENABLE_16BIT_TYPES)
4160+
uint16_t MakeDifferent(uint16_t A) { return A ^ 1; }
4161+
int16_t MakeDifferent(int16_t A) { return A ^ 1; }
4162+
#endif // defined(__HLSL_ENABLE_16BIT_TYPES)
4163+
41504164
vector<OUT_TYPE, NUM> TestWaveActiveAllEqual(vector<TYPE, NUM> Vector)
41514165
{
41524166
if(WaveGetLaneIndex() == (WaveGetLaneCount() - 1))
41534167
{
4154-
Vector[NUM - 1] = (TYPE)1337;
4168+
// We just want to set the last element to any different value.
4169+
Vector[NUM - 1] = MakeDifferent(Vector[NUM - 1]);
41554170
}
41564171
41574172
return WaveActiveAllEqual(Vector);

0 commit comments

Comments
 (0)