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 struct
TargetCostModel
struct TargetCostModel
Maps op tags to hardware cost annotations.
Separates the algorithm (what ops exist) from the target (how much they cost). The algorithm declares logical ops with buffer metadata (tag, stage, subtile, channel, k_offset). The cost model supplies resource kind, latency, and role β the constraints that drive scheduling.
Op tags 0-127 are kernel-specific (registered via set_cost). Op tags 128+ are framework infrastructure ops and are not looked up in the cost model β they carry their own annotations.
Usage: var model = TargetCostModel() model.set_cost(0, OpCost(ResourceKind.GLOBAL_MEM, 200, OpRole.GLOBAL_LOAD)) var annotated = annotate_ops(logical_ops, model)
Implemented traitsβ
AnyType,
Copyable,
ImplicitlyCopyable,
ImplicitlyDestructible,
Movable
Methodsβ
__init__β
__init__(out self)
set_costβ
set_cost(mut self, tag: Int, cost: OpCost)
Register a cost annotation for a kernel op tag (0-127).
get_costβ
Was this page helpful?
Thank you! We'll create more content like this.
Thank you for helping us improve!