llvm / llvm/offload-test-suite

[WARP][Clang] WaveActiveBallot tests fail due to integer truncation to bool

Open
#711 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

driver-bug
Dominant language
C++
Stars
18
Forks
39
Avg merge
2d 18h
Merged PRs (30d)
40

Description

The tests `WaveActiveBallot.Wave32`, `WaveActiveBallot.Wave64`, and `WaveActiveBallot.Wave128` started failing on WARP with Clang after https://github.com/llvm/llvm-project/commit/faa4b97b10c6facb362c5a8d2f0f5c442389a103 was merged into LLVM.

The change in the IR before and after the commit comes from InstCombine being applied to
```hlsl
Out[3] = WaveActiveBallot(threadID.x % 2 == 1);
```

InstCombine transforms instances of `icmp` instructions into `trunc` to `i1`, such as
```llvm
%rem.i = and i32 %1, 1
%cmp8.i = icmp ne i32 %rem.i, 0
```
into the following equivalent truncation:
```llvm
%cmp8.i = trunc i32 %1 to i1
```

This issue also only appears to affect WARP, as can be observed from the following Clang test results on all the machines:

Wave32
```
╭────┬──────────────────────┬─────────────┬────────────────────────────────┬─────────────┬──────────────────────────────────────╮
│ # │ timestamp │ run-id │ workflow │ status │ test │
├────┼──────────────────────┼─────────────┼────────────────────────────────┼─────────────┼──────────────────────────────────────┤
│ 0 │ 2026-02-03T18:15:57Z │ 21642188487 │ Windows D3D12 Warp Clang │ FAIL │ WaveOps/WaveActiveBallot.Wave32.test │
│ 1 │ 2026-02-03T18:21:13Z │ 21642357057 │ Windows ARM64 D3D12 Warp Clang │ FAIL │ WaveOps/WaveActiveBallot.Wave32.test │
│ 2 │ 2026-02-03T20:11:21Z │ 21646031461 │ Windows D3D12 NVIDIA Clang │ PASS │ WaveOps/WaveActiveBallot.Wave32.test │
│ 3 │ 2026-02-03T20:10:06Z │ 21645986872 │ Windows D3D12 Intel Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 4 │ 2026-02-03T18:19:27Z │ 21642301201 │ Windows D3D12 QC Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 5 │ 2026-02-03T20:46:23Z │ 21647192379 │ macOS Metal Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 6 │ 2026-02-03T18:20:50Z │ 21642345045 │ Windows Vulkan AMD Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 7 │ 2026-02-03T20:10:20Z │ 21645995911 │ Windows Vulkan Intel Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 8 │ 2026-02-03T20:07:07Z │ 21645882341 │ Windows Vulkan NVIDIA Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 9 │ 2026-02-03T18:19:19Z │ 21642296487 │ Windows Vulkan QC Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave32.test │
│ 10 │ 2026-02-03T18:19:36Z │ 21642305507 │ Windows D3D12 AMD Clang │ XFAIL │ WaveOps/WaveActiveBallot.Wave32.test │
╰────┴──────────────────────┴─────────────┴────────────────────────────────┴─────────────┴──────────────────────────────────────╯
```

Wave64
```
╭────┬──────────────────────┬─────────────┬────────────────────────────────┬─────────────┬──────────────────────────────────────╮
│ # │ timestamp │ run-id │ workflow │ status │ test │
├────┼──────────────────────┼─────────────┼────────────────────────────────┼─────────────┼──────────────────────────────────────┤
│ 0 │ 2026-02-03T18:15:57Z │ 21642188487 │ Windows D3D12 Warp Clang │ FAIL │ WaveOps/WaveActiveBallot.Wave64.test │
│ 1 │ 2026-02-03T18:21:13Z │ 21642357057 │ Windows ARM64 D3D12 Warp Clang │ FAIL │ WaveOps/WaveActiveBallot.Wave64.test │
│ 2 │ 2026-02-03T18:19:27Z │ 21642301201 │ Windows D3D12 QC Clang │ PASS │ WaveOps/WaveActiveBallot.Wave64.test │
│ 3 │ 2026-02-03T20:10:06Z │ 21645986872 │ Windows D3D12 Intel Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 4 │ 2026-02-03T20:11:21Z │ 21646031461 │ Windows D3D12 NVIDIA Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 5 │ 2026-02-03T20:46:23Z │ 21647192379 │ macOS Metal Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 6 │ 2026-02-03T18:20:50Z │ 21642345045 │ Windows Vulkan AMD Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 7 │ 2026-02-03T20:10:20Z │ 21645995911 │ Windows Vulkan Intel Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 8 │ 2026-02-03T20:07:07Z │ 21645882341 │ Windows Vulkan NVIDIA Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 9 │ 2026-02-03T18:19:19Z │ 21642296487 │ Windows Vulkan QC Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave64.test │
│ 10 │ 2026-02-03T18:19:36Z │ 21642305507 │ Windows D3D12 AMD Clang │ XFAIL │ WaveOps/WaveActiveBallot.Wave64.test │
╰────┴──────────────────────┴─────────────┴────────────────────────────────┴─────────────┴──────────────────────────────────────╯
```

Wave128
```
╭────┬──────────────────────┬─────────────┬────────────────────────────────┬─────────────┬───────────────────────────────────────╮
│ # │ timestamp │ run-id │ workflow │ status │ test │
├────┼──────────────────────┼─────────────┼────────────────────────────────┼─────────────┼───────────────────────────────────────┤
│ 0 │ 2026-02-03T18:15:57Z │ 21642188487 │ Windows D3D12 Warp Clang │ FAIL │ WaveOps/WaveActiveBallot.Wave128.test │
│ 1 │ 2026-02-03T18:21:13Z │ 21642357057 │ Windows ARM64 D3D12 Warp Clang │ FAIL │ WaveOps/WaveActiveBallot.Wave128.test │
│ 2 │ 2026-02-03T18:19:27Z │ 21642301201 │ Windows D3D12 QC Clang │ PASS │ WaveOps/WaveActiveBallot.Wave128.test │
│ 3 │ 2026-02-03T18:19:36Z │ 21642305507 │ Windows D3D12 AMD Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 4 │ 2026-02-03T20:10:06Z │ 21645986872 │ Windows D3D12 Intel Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 5 │ 2026-02-03T20:11:21Z │ 21646031461 │ Windows D3D12 NVIDIA Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 6 │ 2026-02-03T20:46:23Z │ 21647192379 │ macOS Metal Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 7 │ 2026-02-03T18:20:50Z │ 21642345045 │ Windows Vulkan AMD Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 8 │ 2026-02-03T20:10:20Z │ 21645995911 │ Windows Vulkan Intel Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 9 │ 2026-02-03T20:07:07Z │ 21645882341 │ Windows Vulkan NVIDIA Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
│ 10 │ 2026-02-03T18:19:19Z │ 21642296487 │ Windows Vulkan QC Clang │ UNSUPPORTED │ WaveOps/WaveActiveBallot.Wave128.test │
╰────┴──────────────────────┴─────────────┴────────────────────────────────┴─────────────┴───────────────────────────────────────╯
```

Example logs (Windows D3D12 Warp Clang): https://github.com/llvm/offload-test-suite/actions/runs/21642188487/job/62384638556#step:12:770
```
********************
FAIL: OffloadTest-clang-warp-d3d12 :: WaveOps/WaveActiveBallot.Wave32.test (301 of 335)
******************** TEST 'OffloadTest-clang-warp-d3d12 :: WaveOps/WaveActiveBallot.Wave32.test' FAILED ********************
Exit Code: 1

Command Output (stdout):
--
# RUN: at line 61
c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe C:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\WaveOps\WaveActiveBallot.Wave32.test C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp
# executed command: 'c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\split-file.exe' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\OffloadTest\test\WaveOps\WaveActiveBallot.Wave32.test' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp'
# RUN: at line 62
c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\clang-dxc.exe --dxv-path=C:/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin -T cs_6_6 -Fo C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp.o C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp/source.hlsl
# executed command: 'c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\clang-dxc.exe' --dxv-path=C:/actions-runner/_work/offload-test-suite/offload-test-suite/DXC/build/bin -T cs_6_6 -Fo 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp.o' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp/source.hlsl'
# .---command stdout------------
# | Signed DxilContainer written to "C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp.o"
# | Validation succeeded.
# `-----------------------------
# RUN: at line 63
c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\offloader.exe -warp -debug-layer C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp/pipeline.yaml C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp.o
# executed command: 'c:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\bin\offloader.exe' -warp -debug-layer 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp/pipeline.yaml' 'C:\actions-runner\_work\offload-test-suite\offload-test-suite\llvm-project\build\tools\OffloadTest\test\clang-warp-d3d12\WaveOps\Output\WaveActiveBallot.Wave32.test.tmp.o'
# .---command stdout------------
# | Using DirectX API
# | Configuring execution on device: Microsoft Basic Render Driver
# | RootSignature created.
# | Descriptor heap created.
# | Command structures created.
# | Event prepared.
# | Creating UAV: { Size = 64, Register = u1, Space = 0, HasCounter = 0 }
# | EltSize = 4 NumElts = 16
# | UAV: HeapIdx = 0 EltSize = 4 NumElts = 16 HasCounter = 0
# | Buffers created.
# | PSO created.
# | Compute command list created.
# | Compute commands executed.
# | Read data back.
# `-----------------------------
# .---command stderr------------
# | Test failed: Test
# | Comparison Rule: BufferExact
# | Expected:
# | ---
# | Name: ExpectedOut
# | Format: UInt32
# | Stride: 4
# | Data: [ 3221225471, 0, 0, 0, 65535, 0, 0, 0, 0, 0, 0, 0, 2863311530,
# | 0, 0, 0 ]
# | OutputProps:
# | Height: 0
# | Width: 0
# | Depth: 0
# | ...
# | Got:
# | ---
# | Name: Out
# | Format: UInt32
# | Stride: 4
# | Data: [ 3221225471, 0, 0, 0, 65535, 0, 0, 0, 0, 0, 0, 0, 4294967294,
# | 0, 0, 0 ]
# | OutputProps:
# | Height: 0
# | Width: 0
# | Depth: 0
# | ...
# | Full Hex 64bit representation of Expected Buffer Values:
# | [ 0xbfffffff, 0x0, 0x0, 0x0, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xaaaaaaaa, 0x0, 0x0, 0x0 ]
# | Full Hex 64bit representation of Actual Buffer Values:
# | [ 0xbfffffff, 0x0, 0x0, 0x0, 0xffff, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0x0, 0xfffffffe, 0x0, 0x0, 0x0 ]
# |
# `-----------------------------
# error: command failed with exit status: 1

--
```

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start with the WaveOps/WaveActiveBallot.Wave32.test, Wave64.test, and Wave128.test cases and compare the HLSL ballot expression with the Clang IR before and after InstCombine. Run the Clang WARP D3D12 tests shown in the issue; done means these tests produce the expected ballot masks instead of the reported truncated values.

Written by the indexing model from the issue text.

Assessment

Tech stack
cpp
Domain
computer-graphics, testing-qa
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
32/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.