[llvm] [SPIR-V] Add pre-commit CI workflow (PR #74092)

Tom Stellard via llvm-commits llvm-commits at lists.llvm.org
Wed Dec 6 10:45:44 PST 2023


tstellar wrote:

> Do you have any suggestions for how I'd go about checking this? I've never used ccache before, but I just ran a couple tests with it using separate clean build directories and `-DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ -DCMAKE_C_COMPILER=/usr/lib/ccache/clang` but the builds take ~the same time with the same CMake args regardless of whether the cache is cleaned or populated.

I think the way to test it would be:
```
# Configure with default targets:
cmake -G Ninja -S llvm -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_COMPILER=/usr/lib/ccache/clang++ -DCMAKE_C_COMPILER=/usr/lib/ccache/clang

# Build llvm:
ninja -C build

# Save ccache stats
ccache -s > phase1.stats

# Rebuild llvm:
ninja -C build

# Save ccache stats
ccache -s > phase2.stats

# Edit CMakeCache.txt and enable SPIRV
vim build/CMakeCache.txt
-> LLVM_EXPERIMENTAL_TARGETS_TO_BUILD:STRING=SPIRV

# Rebuild llvm:
ninja -C build

# Save ccache stats:
ccache -s > phase3.stats
```
If it worked, when you compare the phase2.stats and phase3.stats output it should should mostly an increase in the Hits category.  I did this test locally and it appears that adding -DLLVM_EXPERIMENTAL_TARGETS_TO_BUILD:STRING=SPIRV does not invalidate the cache, which is good, but the SPIRV backend failed to build, so you might want to double check my work here.



https://github.com/llvm/llvm-project/pull/74092


More information about the llvm-commits mailing list