ISPC (Intel SPMD Program Compiler) is a performance-oriented compiler for vectorized parallel programming.
CMake-based (Unix Makefiles/Ninja)
- Build directory:
build/ - Generated compiler:
build/bin/ispc
Build commands:
cmake -B build
cmake --build build -j $(nproc)Test commands: Lit tests:
cmake --build build --target check-all -j $(nproc)To test the specific test, run:
TEST=/full/path/test.ispc cmake --build build --target check-one -j $(nproc)Functional tests:
PATH=`pwd`/build/bin:$PATH ./scripts/run_tests.py --target=avx2-i32x8Important: Both build and tests take several minutes - use longer timeouts. Some tests may show UNSUPPORTED/XFAIL status normally.
Testing strategy: Lit tests for compilation/parsing changes, functional tests for runtime behavior changes.
- src/: Core compiler source (C++ frontend, AST, codegen, optimizations)
- stdlib/: ISPC standard library (built-in functions, target-specific implementations)
- builtins/: Low-level target-specific LLVM bitcode implementations
- tests/: Comprehensive test suite with functional tests
- examples/: Sample programs demonstrating ISPC usage
- benchmarks/: Performance benchmarks organized by complexity
- ispcrt/: Runtime library for host-device interaction
- docs/: Documentation and design specifications
- scripts/: Build automation and testing utilities
Backend: Heavy LLVM integration for x86/ARM/GPU code generation
- C++17,
lprefix for static methods,Assert()/AssertPos()fromutil.h - ISPC: Reference
docs/for language spec,.ispcfile extension
Implementing a feature or fixing a bug:
- If GitHub issue: use
gh issue view <number>to get details - Explain the problem and reproduce it (use reproducer from issue if available)
- Search codebase for relevant files (use
pattern-finderagent to discover existing patterns and similar implementations) - Create a fix plan
- Implement the fix
- Check git history of files/functions you changed to avoid re-introducing previously fixed bugs:
git log --oneline <file>— recent commits touching the filegit log -L<start>,<end>:<file>— history of a specific line rangegit show <commit>— full diff and message of a specific commit
- Write regression tests in
tests/lit-tests/(useispc-lit-testsskill) and/or functional tests intests/func-tests/ - Verify the fix
- Run
code-reviewagent to review the changes and address its feedback - Run precommit checks (see Precommit Rules below)
- Commit with message:
Fix #<issue_number>: <summary>(for issues) or descriptive summary
Debugging a test failure:
- Run the specific test:
TEST=/full/path/test.ispc cmake --build build --target check-one -j $(nproc) - Examine generated IR:
build/bin/ispc test.ispc -o test.ll --emit-llvm-text - Check assembly:
build/bin/ispc test.ispc -o test.s --emit-asm
Investigating codegen/optimization issues:
- Use
--debug-phase=first:last --dump-file=dbgto dump IR after each phase todbgfolder
Working with builtins:
Use the ispc-builtins skill when modifying files in builtins/ directory.
Before every commit, you MUST complete ALL of these checks:
- Copyright year: Verify the year is 2026 in copyright strings of modified files
- Code formatting: Run
clang-format -ion ALL modified C/C++/header files - Lit tests: Run
cmake --build build --target check-all -j $(nproc)and verify tests pass - Functional tests (if runtime behavior changed): Run
PATH=$(pwd)/build/bin:$PATH ./scripts/run_tests.py --target=avx2-i32x8
Do not commit until all checks pass. Do not skip any of these steps.
- Do only what is asked; nothing more, nothing less
- ALWAYS prefer editing existing files over creating new ones
- NEVER proactively create documentation (*.md) or README files unless explicitly requested
- NEVER leave trailing spaces in files
- Only use emojis if explicitly requested
- Use GitHub CLI (
gh) for all GitHub-related tasks (issues, PRs, etc.) - Stop and ask if anything is unclear or a step fails