﻿# TVM TensorIR scheduling: a legal transformation is a candidate, not a performance result

Separate TVM schedule validity, hardware measurement and tuning-record applicability so legal tiling or thread binding is not mistaken for a demonstrated inference speedup.

Author: Retrivium editorial team
Updated: 2026-11-04
Canonical URL: https://retrivium.ai/journal/fg2-tvm-tir-schedule-legality-versus-tuning-result/
Language: en

## A valid schedule is promoted before it is measured

An engineer applies loop tiling and thread binding to a primitive tensor function. The schedule is accepted, so the resulting kernel is described as faster before any target measurement. Acceptance only shows that the chosen transformation satisfies its checked structural requirements. Register pressure, memory behavior and launch overhead can still make a legal candidate unsuitable for the intended workload. Treat the schedule as a candidate implementation, then evaluate the property that the performance claim actually concerns.

## Schedule primitives have transformation preconditions

The [schedule API reference](https://tvm.apache.org/docs/reference/api/doxygen/classtvm_1_1s__tir_1_1Schedule.html) describes the scheduling interface and primitive operations. Their constraints matter for preserving a valid transformed program. A legal transformation is an important prerequisite, but the interface does not turn acceptance into a benchmark result. Keep the original workload and transformation trace so a failed assumption or later mismatch can be reproduced instead of retaining only the final generated source and an unexplained optimization label.

## MetaSchedule separates search from measurement

The [MetaSchedule tutorial](https://tvm.apache.org/docs/deep_dive/tensor_ir/tutorials/meta_schedule.html) distinguishes candidate generation, search, building, running and persistent records. A cost model guides exploration; actual runner measurements provide evidence about tested candidates. Predictions and measured timings should not be reported as interchangeable observations. The [latency diagnosis guide](/journal/triton-latency-stage-diagnosis/) supplies background for choosing timing scope, while a primitive benchmark still answers a narrower question than the complete request path through an inference service.

## Applying records is a separate compilation action

The [custom optimization tutorial](https://tvm.apache.org/docs/how_to/tutorials/customize_opt.html) describes tuning and applying the resulting database. Record workload identity, target and compilation context when promoting a result. A record from another shape or device is not automatically evidence for this deployment. Compare outputs after the selected schedule is compiled, then measure the intended workload. Keep numerical criteria explicit where transformations affect floating-point evaluation; a legal structural rewrite does not justify replacing application validation with an unqualified speed assertion.

## Explain what won and where it applies

Publish the tested workload, schedule provenance, target configuration and measured scope with the compiled artifact identity. Use [artifact verification](/journal/artifact-signature-verification/) to bind the report to the deployed module. If a later graph changes the primitive or its call frequency, reassess the effect on the whole model. This keeps tuning useful and reproducible: legality narrows the valid search space, measurement identifies observed performance, and release validation determines whether that result still applies to the actual inference program.
