Skip to content

Commit 9c02629

Browse files
committed
fixup! Add AOT code-generation.
1 parent 8249bf1 commit 9c02629

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

src/target/metadata_module.cc

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -124,15 +124,17 @@ static runtime::Module CreateCppMetadataModule(
124124
target_module = const_loader_mod;
125125
}
126126

127-
runtime::metadata::Metadata runtime_metadata = ConvertMetaData(metadata);
128-
129-
if (metadata->executor == runtime::kTvmExecutorAot && runtime->name == relay::kTvmRuntimeCpp) {
130-
if (target->kind->name == "c") {
131-
auto metadata_module = CreateCSourceCppMetadataModule(runtime_metadata);
132-
metadata_module->Import(target_module);
133-
target_module = metadata_module;
134-
} else {
135-
CHECK(false) << "Don't know how to create MetadataModule for target type " << target->str();
127+
if (metadata.defined()) {
128+
runtime::metadata::Metadata runtime_metadata = ConvertMetaData(metadata);
129+
130+
if (metadata->executor == runtime::kTvmExecutorAot && runtime->name == relay::kTvmRuntimeCpp) {
131+
if (target->kind->name == "c") {
132+
auto metadata_module = CreateCSourceCppMetadataModule(runtime_metadata);
133+
metadata_module->Import(target_module);
134+
target_module = metadata_module;
135+
} else {
136+
CHECK(false) << "Don't know how to create MetadataModule for target type " << target->str();
137+
}
136138
}
137139
}
138140

src/target/source/source_module.cc

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -700,8 +700,7 @@ class MetadataSerializer : public AttrVisitor {
700700
if (key != nullptr) {
701701
address_.push_back(key);
702702
}
703-
code_ << address_from_parts(address_) << " , " << arr->array.size() << " /* " << key
704-
<< "_size */";
703+
code_ << address_from_parts(address_);
705704
if (key != nullptr) {
706705
address_.pop_back();
707706
}

0 commit comments

Comments
 (0)