Skip to content

[Docs] Add DLight and MetaSchedule deep-dive instructions#19356

Merged
MasterJH5574 merged 2 commits into
apache:mainfrom
tlopex:doc159
Apr 8, 2026
Merged

[Docs] Add DLight and MetaSchedule deep-dive instructions#19356
MasterJH5574 merged 2 commits into
apache:mainfrom
tlopex:doc159

Conversation

@tlopex

@tlopex tlopex commented Apr 6, 2026

Copy link
Copy Markdown
Member

This pr adds a instructions covering MetaSchedule and Flight usage in deep dive

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request introduces a new tutorial for MetaSchedule, TVM's search-based auto-tuning framework, covering advanced topics such as task inspection, selective operator tuning, and database management. A critical bug was identified in the model execution section where the iteration over model parameters was incorrect and would cause a runtime error.

Comment thread docs/how_to/tutorials/meta_schedule.py Outdated
ex = tvm.compile(final_mod, target)
vm = relax.VirtualMachine(ex, tvm.cpu())
data = tvm.runtime.tensor(np.random.rand(*input_shape).astype("float32"))
tvm_params = [tvm.runtime.tensor(np.random.rand(*p.shape).astype(p.dtype)) for _, p in params]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The params object returned by export_tvm is a list of relax.Constant objects. Iterating over it with for _, p in params] will cause a TypeError as it's not a list of tuples. To correctly iterate, you should use for p in params. Additionally, to access the shape and dtype of a relax.Constant, you must use p.data.shape and p.data.dtype respectively, as the tvm.runtime.NDArray is stored in the data attribute.

Suggested change
tvm_params = [tvm.runtime.tensor(np.random.rand(*p.shape).astype(p.dtype)) for _, p in params]
tvm_params = [tvm.runtime.tensor(np.random.rand(*p.data.shape).astype(p.data.dtype)) for p in params]

@tlopex tlopex marked this pull request as draft April 6, 2026 12:32
@tlopex tlopex marked this pull request as ready for review April 6, 2026 14:23
@tlopex tlopex changed the title [Docs] Add MetaSchedule advanced auto-tuning tutorial [Docs] Add DLight and MetaSchedule deep-dive instructions Apr 6, 2026
@MasterJH5574 MasterJH5574 merged commit 865ace9 into apache:main Apr 8, 2026
10 of 13 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants