Issue 238774
Summary clang/test/Driver/sycl-system-arch.cpp times out on the macOS premerge bot
Labels clang
Assignees
Reporter sendaoYan
    ### Summary

`clang/test/Driver/sycl-system-arch.cpp`, added in 5845c25b47c8 (#229248), fails on the macOS arm64 premerge bot. The driver reports a timeout while running the fake `offload-arch` helper:

```
FAIL: Clang :: Driver/sycl-system-arch.cpp (16289 of 26473)
# | .../clang/test/Driver/sycl-system-arch.cpp:17:11: error: CHECK: expected string not found in input
# | // CHECK: offload, "device-sycl (spirv64-unknown-unknown:xe-pvc)"
# | clang: error: cannot determine sycl architecture:
# |   .../sycl-system-arch.cpp.tmp/offload_arch_sm_70_gfx906_gfx90a_xe_pvc:
# |   Child timed out: ; consider passing it via '--offload-arch';
# |   environment variable CLANG_TOOLCHAIN_PROGRAM_TIMEOUT specifies the tool timeout
```

The helper is a short `/bin/sh` script from `clang/test/Driver/Inputs/offload-arch/` that only echoes architecture names, so a timeout here is unexpected.

### Where the timeout comes from

`Driver::executeProgram()` in `clang/lib/Driver/Driver.cpp` runs the tool with `llvm::sys::ExecuteAndWait(Executable, Args, {}, Redirects, SecondsToWait, ...)`, where `SecondsToWait` defaults to 60 and can be overridden through `CLANG_TOOLCHAIN_PROGRAM_TIMEOUT`. The macOS premerge workflow sets that variable to 120 (`.github/workflows/premerge.yaml`), so the child had two minutes and still did not return.

### Affected runs

The same test is the only failure on several unrelated changes at the same time:

- https://github.com/llvm/llvm-project/actions/runs/41765943794 鈥?change in `llvm/lib/Analysis`
- https://github.com/llvm/llvm-project/actions/runs/41801331749 鈥?[RISCV]
- https://github.com/llvm/llvm-project/actions/runs/41798219844 鈥?[SafeStack]
- https://github.com/llvm/llvm-project/actions/runs/41796630957 鈥?[LV]

In each run it is the single failure out of 55,845 lit tests (check-clang + check-llvm); for example 55,541 passed, 1 failed.

The self-hosted macOS runner was under heavy load at the time: lit reported 11 tests taking 60-80 s and 26 tests taking 20-40 s, and premerge jobs were queuing for 30+ minutes. That points at the helper process being starved rather than at a functional problem with the test or the driver.

### Question

Is there a way to make this test (or the premerge macOS job) robust against a loaded runner? The test genuinely needs to execute a helper to exercise `--offload-arch=native`, so it cannot simply avoid spawning a process. Options I can see, none of which I can evaluate on macOS hardware:

1. Raise `CLANG_TOOLCHAIN_PROGRAM_TIMEOUT` in `.github/workflows/premerge.yaml` (it is already 120 s, which is generous for a script that echoes four lines).
2. Reduce lit parallelism on the macOS runner so individual tests are not starved.
3. Something in `ExecuteAndWait`'s timeout handling on Darwin, if the child is actually stuck rather than merely slow.

I do not have access to a macOS machine to tell which of these it is, so I am reporting it rather than sending a patch.

_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to