Skip to content

[Fix][MetaSchedule] Format names in error and warning messages - #21008

Merged
mshr-h merged 2 commits into
apache:mainfrom
farisbasha:fix-meta-schedule-message-fstrings
Nov 19, 2026
Merged

mshr-h merged 2 commits into
apache:mainfrom
farisbasha:fix-meta-schedule-message-fstrings

Conversation

@farisbasha

Copy link
Copy Markdown
Contributor

Three messages in tvm.s_tir.meta_schedule are plain strings with {...} placeholders, so users see the braces instead of the values:

  • relax_integration.py: warnings.warn("The task {task.task_name} is already scheduled, skipping it.")
  • utils.py, get_global_func_with_default_on_worker: "Function '{name}' is not registered on the worker process. "
  • builder/local_builder.py: raise ValueError("Unreachable: unexpected result: {map_result}")

This adds the missing f prefix to each one.

Test: test_meta_schedule_missing_build_func_error_message in tests/python/s_tir/meta_schedule/test_meta_schedule_builder.py calls get_global_func_with_default_on_worker(name="wrong-name", default=None) and checks that the error names 'wrong-name'. I did not build TVM locally, so CI is the test run.

Three messages in meta_schedule were plain strings with {name}
placeholders, so they showed the braces instead of the values:

- relax_integration.py: the "already scheduled" warning
- utils.py: the "is not registered on the worker process" error
- builder/local_builder.py: the "unexpected result" error

Add the f prefix and a test for the worker-registration error.

@cchung100m cchung100m 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.

LGTM, thanks to @farisbasha

Copilot AI 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.

🟢 Approval recommended

No active review issues remain for the diagnostic-formatting changes.

No open issues 🎉

What changed in this PR

Fixes diagnostic formatting in tvm.s_tir.meta_schedule so warnings and errors display runtime values instead of literal placeholders.

Changes:

  • Adds missing f-string prefixes to three warning and error messages.
  • Adds a regression test verifying that the missing-function error includes the requested function name.
File Description
tests/​python/​s_tir/​meta_schedule/​test_meta_schedule_builder.py Tests the function name in the missing-function error.
python/​tvm/​s_tir/​meta_schedule/​utils.py Interpolates the unregistered function name.
python/​tvm/​s_tir/​meta_schedule/​relax_integration.py Interpolates the skipped task’s name in the warning.
python/​tvm/​s_tir/​meta_schedule/​builder/​local_builder.py Interpolates the unexpected build result in the error.

Review effort: Max

@farisbasha

Copy link
Copy Markdown
Contributor Author

Thanks for the review! Removed the test.

@mshr-h
mshr-h merged commit f2e993d into apache:main Nov 19, 2026
8 checks passed
Netra-Srinivasan-McW pushed a commit to Netra-Srinivasan-McW/tvm-mcw that referenced this pull request Nov 20, 2026
…e#21008)

Three messages in `tvm.s_tir.meta_schedule` are plain strings with
`{...}` placeholders, so users see the braces instead of the values:

- `relax_integration.py`: `warnings.warn("The task {task.task_name} is
already scheduled, skipping it.")`
- `utils.py`, `get_global_func_with_default_on_worker`: `"Function
'{name}' is not registered on the worker process. "`
- `builder/local_builder.py`: `raise ValueError("Unreachable: unexpected
result: {map_result}")`

This adds the missing `f` prefix to each one.

Test: `test_meta_schedule_missing_build_func_error_message` in
`tests/python/s_tir/meta_schedule/test_meta_schedule_builder.py` calls
`get_global_func_with_default_on_worker(name="wrong-name",
default=None)` and checks that the error names `'wrong-name'`. I did not
build TVM locally, so CI is the test run.
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.

4 participants