Skip to content
Back to skills

Relax Compile

ASecurity

"Guides TVM Relax IR construction/import, optimization pipelines,

  • 247 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added September 9, 2026
devopspythondebuggingapifrontendbackend

Works with

  • api

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 9, 2026

npx -y skills add VectorSpaceLab/AREX-Skill --skill relax-compile --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Relax Compile?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Relax Compile
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/vectorspacelab-relax-compile/badge)](https://www.skillsdirectory.com/skills/vectorspacelab-relax-compile)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: relax-compile
description: "Guides TVM Relax IR construction/import, optimization pipelines,
  tvm.compile, executable export/load, and custom codegen boundaries."
disable-model-invocation: true
metadata:
  disco-role: operating
license: Apache 2.0
---

# Relax Compile Workflows

Use this sub-skill when a task involves high-level TVM Relax IR, model import,
optimization pipelines, `tvm.compile`, VM execution, or deployable executable
artifacts.

## Route

1. Confirm TVM imports and has the target backend required by the task. If not,
   first use [`../install-build/SKILL.md`](../install-build/SKILL.md).
2. Decide how the IRModule is created: Relax NN frontend, TVMScript Relax,
   PyTorch/ONNX frontend import, or an existing IRModule.
3. Apply the smallest needed pipeline or pass sequence. `relax.get_pipeline("zero")`
   is a safe baseline for tutorial-style CPU workflows; larger model and dlight
   flows need backend-specific checks.
4. Compile through `tvm.compile(mod, target, relax_pipeline=..., tir_pipeline=...)`.
5. Run the executable locally with `relax.VirtualMachine` or export/load it for a
   deployment workflow.
6. Use [`references/troubleshooting.md`](references/troubleshooting.md) when the
   failure is about target mismatch, optional frontend dependencies, export/load,
   or pass/codegen boundaries.

## Common decisions

- **Tiny local CPU compile:** create or adapt a small Relax IRModule and target
  `llvm`. Run [`scripts/relax_compile_smoke.py`](scripts/relax_compile_smoke.py)
  before diagnosing a larger model.
- **PyTorch or ONNX import:** require the matching frontend dependency and a
  small example input. Keep model downloads, weights, and external datasets out
  of the first debugging loop.
- **Custom optimization:** keep Relax graph passes and TIR/S-TIR scheduling
  passes separate. Route schedule/meta-schedule decisions to
  [`../s-tir-tuning/SKILL.md`](../s-tir-tuning/SKILL.md).
- **Remote execution:** compile/export locally, then use
  [`../rpc-deployment/SKILL.md`](../rpc-deployment/SKILL.md) for upload/load/run
  and tracker/server details.

## API anchor

The verified top-level compile entry point is:

```python
tvm.compile(
    mod,
    target=None,
    *,
    relax_pipeline="default",
    tir_pipeline="default",
)
```

It accepts a Relax/TIR IRModule or TIRx PrimFunc and returns a runtime
`Executable`. The pipeline arguments accept a named pipeline, pass object, or
callable depending on the workflow.

## Boundaries

- Build/import failures are not Relax failures; route to install-build.
- TIRx PrimFunc authoring and tile primitive lowering use tirx-kernels.
- S-TIR schedule primitives and meta-schedule tuning use s-tir-tuning.
- RPC trackers, servers, proxies, and remote-device triage use rpc-deployment.

Files in this skill

  • SKILL.md2.7 KB
  • references/api-reference.md2.4 KB
  • references/troubleshooting.md2.1 KB
  • references/workflows.md3.4 KB
  • scripts/relax_compile_smoke.py2.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.