Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/tvm/script/printer/config.h
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,6 @@ class PrinterConfigNode : public ffi::Object {
*
* Keys are conventionally namespaced as "<dialect>.<knob>", e.g.:
* "tirx.prefix" — the TIR prefix (default "T")
* "tirx.buffer_dtype" — default buffer dtype (default float32)
* "relax.prefix" — the Relax prefix (default "R")
* "relax.show_all_struct_info" — whether to show all struct info (default true)
*
Expand Down Expand Up @@ -127,6 +126,7 @@ class PrinterConfigNode : public ffi::Object {
.def_ro("show_meta", &PrinterConfigNode::show_meta)
.def_ro("ir_prefix", &PrinterConfigNode::ir_prefix)
.def_ro("module_alias", &PrinterConfigNode::module_alias)
.def_ro("buffer_dtype", &PrinterConfigNode::buffer_dtype)
.def_ro("int_dtype", &PrinterConfigNode::int_dtype)
.def_ro("float_dtype", &PrinterConfigNode::float_dtype)
.def_ro("verbose_expr", &PrinterConfigNode::verbose_expr)
Expand Down
3 changes: 2 additions & 1 deletion python/tvm/runtime/script_printer.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ class PrinterConfig(Object):
tir_import_module: str
relax_prefix: str
module_alias: str
buffer_dtype: str
int_dtype: str
float_dtype: str
verbose_expr: bool
Expand Down Expand Up @@ -86,6 +87,7 @@ def __init__(
"tir_import_module": tir_import_module,
"relax_prefix": relax_prefix,
"module_alias": module_alias,
"buffer_dtype": buffer_dtype,
"int_dtype": int_dtype,
"float_dtype": float_dtype,
"verbose_expr": verbose_expr,
Expand All @@ -100,7 +102,6 @@ def __init__(
"obj_to_annotate": obj_to_annotate,
# Dialect-specific config via dotted keys in extra_config
"tirx.prefix": tir_prefix,
"tirx.buffer_dtype": buffer_dtype,
"relax.prefix": relax_prefix,
"relax.show_all_struct_info": show_all_struct_info,
}
Expand Down
8 changes: 3 additions & 5 deletions src/script/printer/script_printer.cc
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,9 @@ PrinterConfig::PrinterConfig(ffi::Map<ffi::String, Any> config_dict) {
if (auto v = config_dict.Get("module_alias")) {
n->module_alias = Downcast<ffi::String>(v.value());
}
if (auto v = config_dict.Get("buffer_dtype")) {
n->buffer_dtype = DataType(ffi::StringToDLDataType(Downcast<ffi::String>(v.value())));
}
if (auto v = config_dict.Get("int_dtype")) {
n->int_dtype = DataType(ffi::StringToDLDataType(Downcast<ffi::String>(v.value())));
}
Expand Down Expand Up @@ -129,11 +132,6 @@ PrinterConfig::PrinterConfig(ffi::Map<ffi::String, Any> config_dict) {
n->extra_config.Set(ffi::String(key), v.value());
}
}
// "tirx.buffer_dtype" is passed as a DLDataType string from Python; convert to DataType.
if (auto v = config_dict.Get("tirx.buffer_dtype")) {
DataType dt(ffi::StringToDLDataType(Downcast<ffi::String>(v.value())));
n->extra_config.Set(ffi::String("tirx.buffer_dtype"), ffi::Any(dt));
}
// Boolean dialect keys.
if (auto v = config_dict.Get("relax.show_all_struct_info")) {
n->extra_config.Set(ffi::String("relax.show_all_struct_info"), v.value());
Expand Down
Loading