Mousius commented on a change in pull request #8280: URL: https://github.com/apache/tvm/pull/8280#discussion_r658846046
########## File path: python/tvm/micro/interface_api.py ########## @@ -0,0 +1,62 @@ +# Licensed to the Apache Software Foundation (ASF) under one +# or more contributor license agreements. See the NOTICE file +# distributed with this work for additional information +# regarding copyright ownership. The ASF licenses this file +# to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance +# with the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, +# software distributed under the License is distributed on an +# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +# KIND, either express or implied. See the License for the +# specific language governing permissions and limitations +# under the License. + +import os + + +def _emit_brief(header_file, model_name, description): + header_file.write("/*!\n") + header_file.write(f" * \\brief TVM {model_name} model {description} \n") + header_file.write(" */\n") + + +def generate_c_interface_header(model_name, inputs, outputs, output_path): + metadata_header = os.path.join(output_path, f"tvm_{model_name}.h") + with open(metadata_header, "w") as header_file: + _emit_brief(header_file, model_name, "input tensors") + header_file.write(f"struct tvm_{model_name}_inputs {{\n") + for input_name in inputs: + header_file.write(f"\tvoid* {input_name};\n") Review comment: I think the holy war can be postponed given we have clang-format and rules predefined :smile_cat: I will update to use spaces. ########## File path: src/target/source/source_module.cc ########## @@ -193,24 +193,24 @@ class CSourceCrtMetadataModuleNode : public runtime::ModuleNode { } void GenerateEntrypointForUnpackedAPI() { - code_ << "TVM_DLL int32_t " << ::tvm::runtime::symbol::tvm_run_func_prefix << "("; - int total_args = (metadata_->num_inputs + metadata_->num_outputs); - for (int i = 0; i < total_args; ++i) { - code_ << "arg" << i; + code_ << "TVM_DLL int " << ::tvm::runtime::symbol::tvm_run_func_prefix << "("; Review comment: Ah, good catch, will fix :vulcan_salute: -- 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]
