Skip to content

VM

-iree-vm-annotate-functionslink

Annotates VM functions with yield/unwind requirements.

Analyzes the call graph to propagate function attributes: - vm.yield: Function may yield, requires resumable execution - vm.unwind: Function requires stack unwinding with ref cleanup

This pass uses SCC-based propagation for efficiency: 1. Single walk per function to collect initial bits and callees 2. Process SCCs in reverse topological order 3. Propagate bits from callees to callers

-iree-vm-conversionlink

Converts from various dialects (standard, HAL, etc) to the VM dialect.

Optionslink

-index-bits                  : Target size of `index` when converted to an integer in bits.
-f32-extension               : Whether the f32 extension is enabled in the target VM.
-f64-extension               : Whether the f64 extension is enabled in the target VM.
-truncate-unsupported-floats : Truncate f64 types to f32 when the f64 extension is not enabled.
-optimize-for-stack-size     : Prefer optimizations that reduce VM stack usage over performance.

-iree-vm-convert-to-yieldable-callslink

Converts calls to yieldable functions to vm.call.yieldable.

Converts vm.call ops that target functions marked with vm.yield to vm.call.yieldable ops. This makes yield points explicit in the IR, enabling proper async handling in the bytecode interpreter and C export.

This pass must run after AnnotateFunctionsPass which marks functions with vm.yield based on call graph analysis.

-iree-vm-deduplicate-rodatalink

Deduplicates vm.rodata ops in the module.

-iree-vm-drop-empty-module-initializerslink

Drops __init/__deinit functions that have no ops.

-iree-vm-drop-optimization-barrierslink

Drops vm.optimization_barrier ops.

Removes vm.optimization_barrier ops by replacing them with their operands. This pass should run after all optimization passes that could fold through the barriers.

-iree-vm-drop-unused-callslink

Drops vm.call ops that have no side effects and are unused.

-iree-vm-global-initializationlink

Creates module-level global init/deinit functions.

Gathers all module-level global init/deinit functions into a single location such that the runtime can init/deinit everything at once. This hides the initialization order rules from the runtime behind singular invocations (__init and __deinit) and prevents the need for the dynamic linker to need initialization order metadata.

-iree-vm-hoist-inlined-rodatalink

Hoists inline vm.rodata.inline values to module-level constant storage.

-iree-vm-materialize-ref-discardslink

Inserts vm.discard.refs ops at ref death points.

Analyzes value liveness and inserts explicit vm.discard.refs operations at points where ref values are no longer needed. This enables functions to be marked as "refs clean" so the runtime can skip cleanup on success.

-iree-vm-ordinal-allocationlink

Assigns module-unique ordinals to function/global/etc symbols within the module.

Assigns per-category ordinals to module-level symbols in the module. Each ordinal is unique per-category and ordinals are contiguous starting from zero.

-iree-vm-reify-rodata-tableslink

Reifies and pads vm.rodata.table.inline ops.

Converts vm.rodata.table.inline ops into two vm.rodata.inline ops: one for the flat data and the other for a newly constructed table for the element subviews.

-iree-vm-resolve-rodata-loadslink

Resolves global loads of rodata ops to direct rodata references.

-iree-vm-sink-defining-opslink

Sinks defining ops with few uses to their use-sites.

Sinks defining ops with few uses to their use-sites to reduce the total number of live registers at the cost of additional storage requirements.