# helia_aot.converter

## AotModel API

The `AotConverter` class is responsible for converting a model into an AOT inference C module.

**Classes**

| Name | Description |
| --- | --- |
| `AotConverter` | Performs the AOT conversion process. |

Copyright 2025 Ambiq. All Rights Reserved.

## helia_aot.converter.AotConverter

`class` · `python`

```python
AotConverter(config: ConvertArgs, registry_context: RegistryContext | None = None)
```

Converts a trained model into a self-contained AOT inference C module.

The converter owns the six-stage pipeline (Load, Transform, Resolve, Plan,
Emit, Export) described on ``convert()``, which is the single entry point;
the CLI is a thin wrapper around it. All behavior is driven by the
``ConvertArgs`` config supplied at construction,
and every dispatch (parsers, operator classes, transforms) goes through the
registry context, so a caller can extend the compiler without patching it.

**Parameters**

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| config | ConvertArgs | Required | Conversion parameters. |
| registry_context | RegistryContext \| None | None | Optional registry context for parser/operator/transform dispatch. If omitted, a fresh default frozen context is created. |

Source: `helia_aot/converter.py:56`

### helia_aot.converter.AotConverter.config

`attribute` · `python`

```python
config: ConvertArgs = config
```

Conversion parameters.

Source: `helia_aot/converter.py:84`

### helia_aot.converter.AotConverter.registry_context

`attribute` · `python`

```python
registry_context = registry_context or build_default_registry_context()
```

Registry context used for parser, operator and
transform dispatch.

Source: `helia_aot/converter.py:85`

### helia_aot.converter.AotConverter.convert

`method` · `python`

```python
convert() -> CodeGenContext
```

Convert the model to an AOT module.

:::note[The conversion process consists of six stages]
1. Load (Backend → AIR)
2. Transform (Graph-Level Optimizations)
3. Resolve (Final AIR Structure)
4. Plan (Memory & Handler Planning)
5. Emit (Code Generation)
6. Export (Module Export)

:::

Code is generated in a temporary work directory that is removed once
the conversion ends, whether it succeeds or fails, unless
``keep_work_dir`` is set.

**Returns**

| Name | Type | Description |
| --- | --- | --- |
| CodeGenContext | CodeGenContext | Code generation context. Its ``work_path`` no |
|  | CodeGenContext | longer exists unless ``keep_work_dir`` is set. |

Source: `helia_aot/converter.py:87`
