[llvm-lit] 20 second delay before any tests are ran
I have been hitting this for about a month and tracked it down to the clang-repl --cuda run in clang/test/lit.cfg.py, specifically have_host_clang_repl_cuda().
On my machine, any llvm-lit run that loads the clang test suite pays about 20 seconds during startup before test discovery/execution. The expensive step is the clang-repl --cuda probe used to determine whether host-supports-cuda should be added.
I ran the same command that have_host_clang_repl_cuda() runs and got the following errors:
module flag identifiers must be unique (or of 'require' type)
!"wchar_size"
module flag identifiers must be unique (or of 'require' type)
!"nvvm-reflect-ftz"
module flag identifiers must be unique (or of 'require' type)
!"frame-pointer"
fatal error: error in backend: Broken module found, compilation aborted!
FYI it also has this 20 second delay
bash repro
printf '%s\n' \
'__global__ void test_func() {}' \
'test_func<<<1,1>>>();' \
'extern "C" int puts(const char *s);' \
'puts(cudaGetLastError() ? "failure" : "success");' \
'%quit' \
| build_Debug/bin/clang-repl --cuda
Lets ignore the fact that i have CUDA installed and an NVIDIA GPU, but llvm-lit still ends up marking the CUDA interpreter tests as unsupported (this is not in the scope of this issue).
The have_host_clang_repl_cuda() probe is run from the global clang/test/lit.cfg.py, so unrelated llvm-lit runs pay the startup cost even though the result is only used by clang/test/Interpreter/CUDA.
Even if the clang-repl --cuda failure is the deeper bug (though I'm not sure if it is), it seems like this probe should not run before general clang test discovery. It would be better if it were limited to the CUDA interpreter test subtree.