Install any skill in seconds. Free to start, no credit card required.
Get Started Free →Best practices for creating ISPC lit tests. Use when writing regression tests, verifying code generation, or checking compiler diagnostics.
.claude/skills/microck-ispc-lit-tests/SKILL.md| Test case | Without → With | Effect | Δ tokens | Δ turns |
|---|---|---|---|---|
| case-01 | ✗→✓ | ▲ Improved | 44% | 0% |
| case-02 | ✗→✓ | ▲ Improved | 19% | 0% |
| case-03 | ✗→✓ | ▲ Improved | 5% | 0% |
| case-04 | ✗→✓ | ▲ Improved | 0% | 0% |
| case-07 | ✗→✓ | ▲ Improved | 6% | 0% |
A concise guide for writing lit tests for the ISPC. These tests ensure compiler correctness, verify generated code, and prevent regressions.
Use lit tests when validating:
--nowrapPrevents line wrapping in compiler output for consistent FileCheck matching:
ispc// RUN: %{ispc} %s --target=host --nowrap --emit-llvm-text -o - | FileCheck %s
--nostdlib When Not Testing Library CodeSimplifies test output and avoids unrelated symbols:
ispc// RUN: %{ispc} %s --target=host --nostdlib --nowrap -o - | FileCheck %s
export Unless Testing Itexport functions generate both masked and unmasked IR — doubling the verification effort.
ispc// Preferred void foo() { ... } // Avoid unless explicitly testing export behavior export void foo() { ... }
Use --target=host unless verifying target-specific codegen:
ispc// RUN: %{ispc} %s --target=host --nowrap -o - | FileCheck %s
Avoid hardcoding vector widths or variable names. Use named patterns like [[WIDTH]] and [[TYPE]].
Example:
ispc// CHECK-NEXT: %test = sdiv <[[WIDTH:.*]] x i32> %a, %b // CHECK-NEXT: ret <[[WIDTH]] x i32> %test
When order is flexible:
ispc// CHECK-DAG: {{%.*}} = shufflevector <[[WIDTH:.*]] x [[BASE_TYPE:i.*]]> {{%.*}}, <[[WIDTH]] x [[BASE_TYPE]]> {{poison|undef}}, <[[WIDTH]] x [[BASE_TYPE]]> zeroinitializer
Tip: Avoid relying on exact variable names — they differ between OS and LLVM versions.
When output differs by architecture or ISA:
REQUIRES: directive for conditional execution.Example:
ispc// RUN: %{ispc} %s --target=avx512skx-x16 --emit-asm -o - | FileCheck %s // REQUIRES: X86_ENABLED
REQUIRES for Feature DependenciesDefined in tests/lit-tests/lit.cfg:
X86_ENABLED, LLVM_*_0+, etc.%{ispc}, %s, %tUse --debug-phase to capture output of specific optimization passes:
ispc// RUN: %{ispc} %s --target=avx2 --emit-llvm-text \ // RUN: --debug-phase=325:325 --dump-file=%t -o /dev/null // RUN: FileCheck --input-file %t/ir_325_LoadStoreVectorizerPass.ll %s
Clearly describe what the test verifies and why it exists.
Example:
ispc// Verifies that stmxcsr/ldmxcsr intrinsics correctly set/restore FTZ/DAZ flags // when --opt=reset-ftz-daz is enabled.
ispc// Brief description of the test purpose // RUN: %{ispc} %s --target=host --nostdlib --nowrap --emit-llvm-text -o - | FileCheck %s // REQUIRES: <feature_if_needed> // CHECK-LABEL: @function_name___ // CHECK: expected pattern // CHECK-NOT: unexpected pattern void function_name() { // Minimal reproducible test code here }
Run all lit tests:
bashcmake --build build --target check-all -j $(nproc)
To test the specific test, run:
bashTEST=/full/path/test.ispc cmake --build build --target check-one -j $(nproc)
####.ispc, where #### is the GitHub issue number.feature-name-1.ispc, feature-name-2.ispc).| Case | Status | Duration (ms) | Turns | Tokens | Tool calls | ||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| Without | With | Δ | Without | With | Δ | Without | With | Δ | Without | With | Δ | ||
case-01 | fail→pass | 9,881 | 7,062 | -29% | 1 | 1 | 0% | 1,725 | 2,481 | +44% | 0 | 0 | — |
case-02 | fail→pass | 10,815 | 10,925 | +1% | 1 | 1 | 0% | 1,897 | 2,262 | +19% | 0 | 0 | — |
case-03 | fail→pass | 13,700 | 6,511 | -52% | 1 | 1 | 0% | 2,312 | 2,418 | +5% | 0 | 0 | — |
case-04 | fail→pass | 13,928 | 7,164 | -49% | 1 | 1 | 0% | 2,347 | 2,353 | +0% | 0 | 0 | — |
case-05 | pass→pass | 11,788 | 5,939 | -50% | 1 | 1 | 0% | 1,984 | 2,150 | +8% | 0 | 0 | — |
case-06 | pass→pass | 13,287 | 5,815 | -56% | 1 | 1 | 0% | 2,206 | 2,038 | -8% | 0 | 0 | — |
case-07 | fail→pass | 12,523 | 6,858 | -45% | 1 | 1 | 0% | 2,276 | 2,408 | +6% | 0 | 0 | — |
case-08 | pass→pass | 19,143 | 2,771 | -86% | 1 | 1 | 0% | 1,392 | 1,448 | +4% | 0 | 0 | — |
case-09 | pass→pass | 9,702 | 3,822 | -61% | 1 | 1 | 0% | 1,494 | 1,687 | +13% | 0 | 0 | — |
case-10 | fail→pass | 21,732 | 2,549 | -88% | 1 | 1 | 0% | 3,548 | 1,535 | -57% | 0 | 0 | — |
case-11 | pass→pass | 15,761 | 4,238 | -73% | 1 | 1 | 0% | 2,369 | 1,823 | -23% | 0 | 0 | — |
case-12 | pass→pass | 5,150 | 3,061 | -41% | 1 | 1 | 0% | 728 | 1,631 | +124% | 0 | 0 | — |
case-13 | pass→pass | 7,178 | 2,242 | -69% | 1 | 1 | 0% | 1,165 | 1,519 | +30% | 0 | 0 | — |
case-14 | pass→pass | 4,613 | 2,673 | -42% | 1 | 1 | 0% | 658 | 1,581 | +140% | 0 | 0 | — |
case-15 | pass→pass | 3,294 | 3,018 | -8% | 1 | 1 | 0% | 509 | 1,597 | +214% | 0 | 0 | — |
case-16 | pass→pass | 15,760 | 7,879 | -50% | 1 | 1 | 0% | 2,351 | 2,354 | +0% | 0 | 0 | — |
case-17 | pass→pass | 15,661 | 6,839 | -56% | 1 | 1 | 0% | 2,405 | 2,294 | -5% | 0 | 0 | — |
case-18 | fail→pass | 12,535 | 3,458 | -72% | 1 | 1 | 0% | 2,301 | 1,751 | -24% | 0 | 0 | — |
case-19 | pass→pass | 13,306 | 7,857 | -41% | 1 | 1 | 0% | 1,940 | 2,502 | +29% | 0 | 0 | — |
case-20 | pass→pass | 4,396 | 2,881 | -34% | 1 | 1 | 0% | 708 | 1,611 | +128% | 0 | 0 | — |
case-21 | pass→pass | 2,844 | 4,613 | +62% | 1 | 1 | 0% | 484 | 1,944 | +302% | 0 | 0 | — |
case-22 | pass→pass | 5,932 | 4,287 | -28% | 1 | 1 | 0% | 938 | 1,846 | +97% | 0 | 0 | — |
DecimalAI ran this skill against gemini-3.6-flash twice over the same eval suite — once with the skill loaded and once without — and compared the two runs case by case. 22 cases were attempted. The headline lift of +32 percentage points is the difference between those two pass rates over the 22 comparable cases.
Without the skill loaded, the model failed this case. With it loaded, the same prompt on the same model passed. This is one improved case from the latest verified run; every case, including any that regressed, is in the table above.
Other measured skills in the registry, with their headline benchmark lift.