This is an automated email from the ASF dual-hosted git repository.
syfeng pushed a commit to branch test_all_cases_on_unity
in repository https://gitbox.apache.org/repos/asf/tvm.git
commit c1523ab50a035909e7dcf4283be60c08846c0d39
Author: Siyuan Feng <hz...@sjtu.edu.cn>
AuthorDate: Sun Dec 3 15:25:08 2023 +0800
[Unity] Fix Rust IRModule Constructor
The unity branch adds a new attr `global_infos` to the IRModule,
this PR fixes the constructor of IRModule in Rust.
---
rust/tvm/src/ir/module.rs | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/rust/tvm/src/ir/module.rs b/rust/tvm/src/ir/module.rs
index 4cdca826ec..bae5ad87cc 100644
--- a/rust/tvm/src/ir/module.rs
+++ b/rust/tvm/src/ir/module.rs
@@ -62,7 +62,7 @@ external! {
#[name("relay.parser.ParseExpr")]
fn parse_expression(file_name: TVMString, source: TVMString) -> IRModule;
#[name("ir.IRModule")]
- fn module_new(funcs: Map<GlobalVar, BaseFunc>, types: Map<GlobalTypeVar, TypeData>, attrs: Map<TVMString, ObjectRef>) -> IRModule;
+ fn module_new(funcs: Map<GlobalVar, BaseFunc>, types: Map<GlobalTypeVar, TypeData>, attrs: Map<TVMString, ObjectRef>, global_infos: Map<TVMString, Array<ObjectRef>>) -> IRModule;
// Module methods
#[name("ir.Module_Add")]
fn module_add(module: IRModule, type_name: GlobalVar, expr: BaseFunc, update: bool) -> IRModule;
@@ -99,7 +99,7 @@ external! {
// Note: we don't expose update here as update is going to be removed.
impl IRModule {
- pub fn new<'a, F, T, A>(funcs: F, types: T, attrs: A) -> Result<IRModule>
+ pub fn new<'a, F, T, A, G>(funcs: F, types: T, attrs: A, global_infos: G) -> Result<IRModule>
where
F: IntoIterator<Item = (&'a GlobalVar, &'a BaseFunc)>,
T: IntoIterator<Item = (&'a GlobalTypeVar, &'a TypeData)>,
@@ -109,6 +109,7 @@ impl IRModule {
Map::from_iter(funcs),
Map::from_iter(types),
Map::from_iter(attrs),
+ Map::from_iter(global_infos),
)
}
@@ -116,7 +117,8 @@ impl IRModule {
let funcs = HashMap::<GlobalVar, BaseFunc>::new();
let types = HashMap::<GlobalTypeVar, TypeData>::new();
let attrs = HashMap::<TVMString, ObjectRef>::new();
- IRModule::new(funcs.iter(), types.iter(), attrs.iter())
+ let global_infos = HashMap::<TVMString, Array<ObjectRef>>::new();
+ IRModule::new(funcs.iter(), types.iter(), attrs.iter(), global_infos.iter())
}
pub fn parse<N, S>(file_name: N, source: S) -> Result<IRModule>