Skip to content

[REFACTOR][SCRIPT] Revive buffer_dtype as a top-level PrinterConfig field#19640

Closed
tqchen wants to merge 1 commit into
apache:mainfrom
tqchen:tvm-revive-buffer-dtype-top-level
Closed

[REFACTOR][SCRIPT] Revive buffer_dtype as a top-level PrinterConfig field#19640
tqchen wants to merge 1 commit into
apache:mainfrom
tqchen:tvm-revive-buffer-dtype-top-level

Conversation

@tqchen
Copy link
Copy Markdown
Member

@tqchen tqchen commented May 28, 2026

Summary

Restore buffer_dtype as a top-level field on PrinterConfig (alongside int_dtype and float_dtype). The tvmscript streamline refactor moved it into extra_config, but buffer_dtype is a shared scalar-literal default rather than a dialect-specific knob. Bringing it back to top-level keeps it discoverable, type-checked at the C++ layer, and consistent with its sibling scalar dtype fields.

Files

  • include/tvm/script/printer/config.h — restore DataType buffer_dtype field + reflection registration.
  • src/script/printer/script_printer.cc — restore the top-level "buffer_dtype" string→DataType conversion in the PrinterConfig constructor.
  • src/tirx/script/printer/buffer.cc — use cfg->buffer_dtype directly instead of GetExtraConfig<DataType>("tirx.buffer_dtype", ...).
  • python/tvm/runtime/script_printer.py — re-add buffer_dtype: str = "float32" field and kwarg.

…ield

buffer_dtype was moved to extra_config in the tvmscript streamline
refactor, but it is conceptually a shared scalar-literal default
alongside int_dtype and float_dtype, not a dialect-specific knob.
Restore it as a top-level named field on PrinterConfigNode (and the
Python PrinterConfig mirror), with the same DataType::Float(32)
default and the same top-level cfg-dict conversion pattern as the
sibling dtype fields. Update the single C++ reader in
src/tirx/script/printer/buffer.cc to use cfg->buffer_dtype directly.
Copy link
Copy Markdown
Contributor

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

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 promotes buffer_dtype from a dialect-specific extra configuration option (tirx.buffer_dtype) to a first-class configuration field in PrinterConfig. This change is implemented across the C++ header, Python bindings, and parsing logic. There are no review comments to address, and the changes appear correct and complete.

@tqchen tqchen closed this May 28, 2026
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.

1 participant