Bug Description
When Warp is built against LLVM 22, Clang rejects the CPU precompiled header with an error similar to:
error: OptimizationLevel differs in precompiled file ... vs. current file
Warp: Compilation with PCH failed, retrying without precompiled headers
The PCH is generated at -O3, while CPU kernel modules are compiled at -O2. LLVM 22 checks the code-generation options stored in the PCH and rejects it when the optimization levels differ.
Warp then deletes the rejected PCH and recompiles the module without it. The module still compiles, but the next module generates another incompatible PCH and repeats the same fallback. As a result:
- CPU module builds do not benefit from the PCH cache.
- Each module pays for PCH generation followed by a full non-PCH compilation.
- The PCH cache directory is left without a reusable PCH.
- The existing CPU PCH tests fail.
Reproduction
- Build Warp against LLVM 22.1.8.
- Set
WARP_CACHE_PATH to a new, empty directory.
- Save and run the following script:
import warp as wp
wp.config.verbose = True
wp.config.use_precompiled_headers = True
@wp.kernel(module="unique")
def kernel(values: wp.array[float]):
tid = wp.tid()
values[tid] = float(tid)
values = wp.zeros(8, dtype=float, device="cpu")
wp.launch(kernel, dim=8, inputs=[values], device="cpu")
print(values.numpy())
The kernel runs successfully, but the compilation log reports the PCH optimization-level mismatch and the fallback compilation.
Expected behavior
CPU modules should compile using the generated PCH without Clang rejecting it. The PCH should remain in the cache and be reusable by subsequent compatible module builds.
The stricter PCH validation was introduced by llvm/llvm-project#146422. LLVM 21 and earlier accept the mismatched PCH because they do not perform this validation.
System Information
Reproduced with:
- Warp built from
main
- LLVM 22.1.8
- Windows x86-64 and Windows Arm64
- CPU-only Warp build
Bug Description
When Warp is built against LLVM 22, Clang rejects the CPU precompiled header with an error similar to:
The PCH is generated at
-O3, while CPU kernel modules are compiled at-O2. LLVM 22 checks the code-generation options stored in the PCH and rejects it when the optimization levels differ.Warp then deletes the rejected PCH and recompiles the module without it. The module still compiles, but the next module generates another incompatible PCH and repeats the same fallback. As a result:
Reproduction
WARP_CACHE_PATHto a new, empty directory.The kernel runs successfully, but the compilation log reports the PCH optimization-level mismatch and the fallback compilation.
Expected behavior
CPU modules should compile using the generated PCH without Clang rejecting it. The PCH should remain in the cache and be reusable by subsequent compatible module builds.
The stricter PCH validation was introduced by llvm/llvm-project#146422. LLVM 21 and earlier accept the mismatched PCH because they do not perform this validation.
System Information
Reproduced with:
main