# SIR and Backends

SIR, short for Silicon IR, is the graph-oriented lowering path used for Vex's data-parallel execution model.

## What SIR Is For

SIR is the part of the architecture that turns array-, tensor-, and graph-friendly computation into backend-specific execution plans.

Typical features routed through or associated with this layer include:

- tensor and mask lowering
- fused arithmetic graphs
- reductions and SIMD-oriented ops
- backend-specific code generation

## Main Idea

```text
Vex source
  -> HIR
  -> SIR graph
  -> optimization / fusion / lowering
  -> backend codegen
```

## Code Generation and Execution

Each route needs several independently implemented pieces:

1. HIR lowering for the operation, type and shape.
2. A legal SIR graph and backend emitter.
3. A compatible kernel representation, such as MSL, PTX or SPIR-V.
4. A runtime executor and compiler bridge using the same buffer/entry contract.
5. A compatible device, installed provider and numerical validation.

An emitter producing text proves only one step. For example, ROCm HIP source
is not a loadable HSACO code object; a WebGPU runtime executor does not by itself
make every legacy compiler-generated GPU call ABI compatible. The
[backend reference](sir-backends-reference.md) separates these routes.

## Routing and Fallbacks

The architecture includes runtime/backend selection and fallback logic. That means a graph may:

- stay on SIMD/CPU
- route to a specific backend
- fall back depending on capability, shape, or runtime constraints

This is part of why backend maturity and runtime availability both matter.

## Where to Read Next

- [SIMD Overview](../guide/simd/index.md)
- [GPU Programming](../guide/gpu/index.md)
- [Fusion Graph](../guide/fusion/graph.md)
- [Runtime & Tooling](runtime-and-tooling.md)
