check
Detects CUDA/HIP bugs without a GPU by rerunning kernels in varied thread orders and under sanitizers to find missing __syncthreads(), races, uninitialized reads, and leaks at source lines.
Instructions
Look for bugs in a CUDA or HIP program without a GPU. Runs it with the threads of each block in several orders (forward, reverse, random with several seeds, warp orders): a result that changes with the order means a missing __syncthreads() or __syncwarp(), or a race. Also reports cuda4cpu's checks (divergent barriers and warp operations, copies in the wrong direction, allocations never freed), runs with new allocations filled with 0xff bytes (a changed result means reads of memory never written; when the output varies, it runs with 0xff bytes and with zeros twice each, and a result that each fill makes steady but the two make different means the same), and runs a build with AddressSanitizer and UBSan (out-of-bounds and use-after-free accesses, undefined behavior), with source lines. The program should check its own results or print them; output that varies between identical runs (timings) is compared by exit code only, unless ignore_patterns removes the lines that vary.
Tool call template
This tool declares no required parameters. Add optional parameters from the input schema as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {},
"name": "check"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| args | No | The program's arguments | |
| files | No | Sources by file name (relative paths) and their contents: .cu or .hip files, .cpp host files, and headers they include | |
| paths | No | Existing source files to compile where they are | |
| seeds | No | Seeds of the random orders (default 1, 2, 3) | |
| stdin | No | Input for the program | |
| options | No | Compiler options, as nvcc's (-arch, -Xcompiler, -std, -I, -D, ...) or hipcc's; GPU options are accepted and ignored. Default -O2 -g. | |
| language | No | cuda (cuda4cpu-nvcc, the default) or hip (cuda4cpu-hipcc, the default when a source is a .hip file) | |
| sanitizers | No | Also run with AddressSanitizer and UBSan (default true) | |
| environment | No | More environment variables for the program | |
| ignore_patterns | No | Regular expressions of output lines to leave out of the comparison between orders, such as timings | |
| timeout_seconds | No | Time limit for each run (default 60, at most 600) | |
| working_directory | No | Where the program runs: by default, the directory of the last path given, or the directory of the inline files |