fPecc commented on code in PR #12789:
URL: https://github.com/apache/tvm/pull/12789#discussion_r972978640
##########
src/target/source/interface_c.cc:
##########
@@ -46,20 +46,46 @@ class InterfaceCNode : public runtime::ModuleNode {
InterfaceCNode(std::string module_name, Array<String> inputs, Array<String>
outputs,
Array<tir::usmp::AllocatedPoolInfo> pools,
Map<String, tir::usmp::PoolAllocation> io_pool_allocations,
Array<String> devices,
- int workspace_size)
+ int workspace_size, Map<String, IntImm> input_sizes,
+ Map<String, IntImm> output_sizes)
: module_name_(module_name),
inputs_(inputs),
outputs_(outputs),
devices_(devices),
pools_(FilterExternalPools(pools)),
io_pool_allocations_(io_pool_allocations),
- workspace_size_(workspace_size) {}
+ workspace_size_(workspace_size),
+ input_sizes_(input_sizes),
+ output_sizes_(output_sizes) {}
const char* type_key() const final { return "h"; }
std::string GetSource(const std::string& format) final {
std::stringstream code;
EmitUpperHeaderGuard(code);
+
+ // Emit macros for input sizes
+ for (auto const& it : input_sizes_) {
+ auto input_name = std::string(it.first);
+ std::replace(input_name.begin(), input_name.end(), ':', '_');
+ std::replace(input_name.begin(), input_name.end(), '+', '_');
+ std::replace(input_name.begin(), input_name.end(), '-', '_');
+ auto input_size = it.second->value;
+ EmitIntegerValueMacro(code, "Input tensor " + input_name + " size (in
bytes)", input_name,
Review Comment:
just added it in a new commit
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]