gala-codegen-classical
Work with Gala's classical codegen — Cranelift (debug) and LLVM (release) for orchestration layer
Skill by gala-pl
Install
Works with Claude Code, Claude apps, Codex, Cursor, Gemini CLI, GitHub Copilot, VS Code, OpenCode, Goose, Windsurf. Read the repository before you give any tool access to your data.
npx agentmarket install skill/gala-pl-gala-codegen-classical
Asks which of your tools to add it to (Claude Code, Codex, Cursor, VS Code, Windsurf, Gemini CLI, Claude Desktop) and shows the change first. See https://agentmart.dev/cli.
Get the weekly diff
The weekly diff: one email a week with new agent tools, notable updates and grade changes, plus security alerts for tools you follow. Double opt-in, one-click unsubscribe.
About
Reviews
Write a reviewNo reviews yet. Installed it? Reviews come from verified installers only. How reviews work
Permissions
What this skill can do and what it asks for, from its SKILL.md. Checked Oct 25, 2026.
- Tools
- No tools found
- Secrets
- None asked for
- Install scripts
- None found
Network hosts it talks to 1
codeload.github.com· found in install command
Files it touches
~/.claude/skills/gala-codegen-classical
Tools it pre-approves 9
From allowed-tools in SKILL.md: the agent may use these without asking you each time.
Bash(cargobuild*)testReadWriteEditGlobGrep
What's inside
- Skill name
gala-codegen-classical- Description
- Work with Gala's classical codegen — Cranelift (debug) and LLVM (release) for orchestration layer
- License
- Apache-2.0
- Allowed tools
- Bash(cargo, build, *), Bash(cargo, test, *), Read, Write, Edit, Glob, Grep
- Instructions
- 83 lines in SKILL.md · view on GitHub
Before installing
- Pre-approves some shell commands
Files (1)
- SKILL.md
SKILL.md (first lines)
## Task
$ARGUMENTS
## Context
Gala's classical codegen (`crates/gala-codegen-classical`) compiles the **classical orchestration layer** (loops, optimizers, data handling, gradient descent) to native code. Uses **Cranelift** for fast debug builds, **LLVM (via inkwell)** for optimized releases.
> **Note on file layout:** The crate currently lives in a single `crates/gala-codegen-classical/src/lib.rs`. As it matures it may be split into `cranelift.rs`, `llvm.rs`, `lower.rs`, `runtime.rs` (see `docs/ARCHITECTURE.md`). When in doubt, search for the relevant code in `lib.rs`.
Key files:
- `crates/gala-codegen-classical/src/lib.rs` — Classical lowering, Cranelift/LLVM backends
## Common Tasks
### Add classical op lowering
1. Edit `lib.rs` — map GIR classical `NodeKind` (Add, Mul, Call, etc.) to backend IR
2. Implement for both Cranelift and LLVM backends
3. Handle calling convention for Gala → Rust FFI
4. Test: compile and run classical-only function
### Optimize codegen for release
1. Edit `lib.rs` — add LLVM optimization passes (inline, vectorize, etc.)
2. Ensure `pure` functions get optimized aggressively
3. Benchmark: orchestration binary perf vs interpreted baseline
### Add runtime intrinsic
1. Edit `lib.rs` — define host function signature
2. Implement in `gala-runtime` (Rust side)
3. Lower call to runtime function
4. Test: end-to-end hybrid program
### Switch default backend
- Debug: `cargo build --features codegen-cranelift` (default)
- Release: `cargo build --release --features codegen-llvm`
- Both features can coexist; CLI flag selects
## Testing
```bash
cargo test -p gala-codegen-classical # Unit tests
cargo test --workspace codegen-classical # All codegen tests
cargo build --release --features codegen-llvm # Release build
cargo run --bin gala -- build examples/classical_only.gala --target native # Debug
```
## Conventions
- **Orchestration layer only** — quantum ops go to QIR/sim, not here
- **Cranelift for speed** — fast incremental debug builds
- **LLVM for perf** — optimized release artifacts
- **Shared lowering** — `lib.rs` feeds both backends
- **FFI-compatible** — Gala calls Rust runtime, Rust calls Gala entry points
- No `unwrap()` on user paths
## Key Lowering
```rust
// Classical GIR ops → backend IR
fn lower_op(builder: &mut Builder, op: &GirNode) {
match op.kind {
NodeKind::Classical(ClassicalOp::Add) => builder.ins().fadd(op.operands[0], op.operands[1]),
NodeKind::Classical(ClassicalOp::Mul) => builder.ins().fmul(op.operands[0], op.operands[1]),
NodeKind::Classical(ClassicalOp::Call(func_id)) => lower_call(builder, func_id, &op.operands),
// ... control flow, memory, etc.
}
}
```
## Debugging
```bash
# Emit Cranelift IR (debug)
cargo run --bin gala -- --emit clif examples/classical_only.gala
# Emit LLVM IR (release)
cargo run --bin gala -- --emit llvm examples/classical_only.gala --features codegen-llvm
# Run compiled binary
cargo run --bin gala -- build examples/classical_only.gala --target native
./target/gala/examples/classical_only
```From gala-pl/gala, Apache-2.0.
More from gala-pl/gala
- 0.584score
gala-diff
gala-pl
Work with Gala's native differentiation — parameter-shift for quantum params, reverse-mode autodiff for classical, chain-rule composition
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-hardware-backends
gala-pl
Run Gala programs on quantum hardware — backend selection, capability checking, QIR emission, vendor SDKs
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-language-basics
gala-pl
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-noise-modeling
gala-pl
Model and simulate noise in Gala — typed noise models, QuEST noise channels, error mitigation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-performance
gala-pl
Optimize Gala program performance — gate count, circuit depth, gradient cost, compilation time
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-python-interop
gala-pl
Call Gala from Python — PyO3 bridge, Jupyter kernel, PyTorch integration, NumPy arrays
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-quantum-algorithms
gala-pl
Implement quantum algorithms in Gala — QFT, Grover, phase estimation, adders, oracles
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-vqa-programming
gala-pl
Build variational quantum algorithms in Gala — encoders, ansätze, optimizers, native grad
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-ast
gala-pl
Work with Gala's AST — add node types, implement visitors, maintain CST/AST separation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-driver
gala-pl
Work with Gala's compilation driver — salsa DB orchestration, incremental queries, pipeline wiring
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
debug-compiler
gala-pl
Debug a compiler error or unexpected behavior in Gala source code
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-cookbook
gala-pl
Gala recipes — common patterns, idioms, algorithms, VQA templates, error handling
SkillAFreshness: A★ 1Claude Code +9
Signals
- Stars
- 1
- Forks
- 0
- Open issues
- 0
- Last commit (this folder)
- Oct 23, 2026 (5 days ago)
From GitHub (fetched Oct 24, 2026).
Details
- License
- Apache-2.0
- Repository
- github.com/gala-pl/gala
- First seen
- Oct 24, 2026
- Last checked
- Oct 24, 2026
- Source
- GitHubgithub-graphql
More from gala-pl
- 0.584score
gala-diff
gala-pl
Work with Gala's native differentiation — parameter-shift for quantum params, reverse-mode autodiff for classical, chain-rule composition
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-language-basics
gala-pl
Learn Gala language fundamentals — syntax, types, effects, linear qubits, basic quantum operations
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-noise-modeling
gala-pl
Model and simulate noise in Gala — typed noise models, QuEST noise channels, error mitigation
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-performance
gala-pl
Optimize Gala program performance — gate count, circuit depth, gradient cost, compilation time
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-python-interop
gala-pl
Call Gala from Python — PyO3 bridge, Jupyter kernel, PyTorch integration, NumPy arrays
SkillAFreshness: A★ 1Claude Code +9 - 0.581score
gala-hardware-backends
gala-pl
Run Gala programs on quantum hardware — backend selection, capability checking, QIR emission, vendor SDKs
SkillAFreshness: A★ 1Claude Code +9
Cite this page
gala-codegen-classical skill. Agent Mart. https://agentmart.dev/skills/gala-pl-gala-codegen-classical (last updated 2026-10-24)