Skip to content

Commit

Permalink
fix segfault with devices
Browse files Browse the repository at this point in the history
  • Loading branch information
areusch committed Jan 4, 2022
1 parent 3341990 commit 94a72c3
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/target/metadata.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ class InMemoryMetadataNode : public ::tvm::target::metadata::VisitableMetadataNo
outputs_{new struct TVMTensorInfo[outputs.size()]()},
outputs_objs_{outputs},
devices_{new const char*[devices.size()]()},
devices_objs_{devices},
executor_{executor},
mod_name_{mod_name},
interface_api_{interface_api},
Expand Down Expand Up @@ -125,7 +126,7 @@ class InMemoryMetadataNode : public ::tvm::target::metadata::VisitableMetadataNo
storage_.devices = devices_.get();
storage_.num_devices = devices.size();
for (unsigned int i = 0; i < devices.size(); ++i) {
devices_.get()[i] = devices[i].c_str();
devices_.get()[i] = devices_objs_[i].c_str();
}
}

Expand All @@ -135,6 +136,7 @@ class InMemoryMetadataNode : public ::tvm::target::metadata::VisitableMetadataNo
::std::unique_ptr<struct TVMTensorInfo> outputs_;
std::vector<::tvm::runtime::metadata::TensorInfo> outputs_objs_;
::std::unique_ptr<const char*> devices_;
std::vector<::std::string> devices_objs_;
::std::string executor_;
::std::string mod_name_;
::std::string interface_api_;
Expand Down

0 comments on commit 94a72c3

Please sign in to comment.