IMPORTANT: To view this page as Markdown, append `.md` to the URL (e.g. /max/get-started.md). For the complete documentation index, see llms.txt.
Skip to main content
For the complete documentation index, see llms.txt. Markdown versions of all pages are available by appending .md to any URL (e.g. /max/get-started.md).

Mojo function

annotate_ops

annotate_ops(ops: List[OpDesc], model: TargetCostModel) -> List[OpDesc]

Apply a target cost model to logical ops.

For each op with a kernel-specific tag (< 128), looks up the cost model and fills in resource, latency, and role. Infrastructure ops (tag >= 128) are passed through unchanged — they carry their own annotations.

This is the bridge between the algorithm (which declares logical ops via OpDesc.logical()) and the scheduler (which needs resource/latency data).

Returns:

List[OpDesc]