You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by GitBox <gi...@apache.org> on 2021/09/13 20:32:34 UTC

[GitHub] [tvm] grant-arm commented on a change in pull request #8849: [5/6] Arm(R) Ethos(TM)-U NPU codegen integration

grant-arm commented on a change in pull request #8849:
URL: https://github.com/apache/tvm/pull/8849#discussion_r707659412



##########
File path: src/relay/backend/contrib/ethosu/source_module.cc
##########
@@ -0,0 +1,320 @@
+/*
+ * 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.
+ */
+#include <dmlc/filesystem.h>
+#include <dmlc/logging.h>
+#include <dmlc/memory_io.h>
+#include <tvm/ir/expr.h>
+#include <tvm/runtime/c_runtime_api.h>
+#include <tvm/runtime/memory.h>
+#include <tvm/runtime/module.h>
+#include <tvm/runtime/ndarray.h>
+#include <tvm/runtime/object.h>
+#include <tvm/runtime/packed_func.h>
+#include <tvm/runtime/registry.h>
+
+#include <cmath>
+#include <fstream>
+#include <map>
+#include <sstream>
+#include <string>
+#include <vector>
+
+#include "../../../../runtime/file_utils.h"
+
+namespace tvm {
+namespace runtime {
+
+class EthosUModuleNode : public ModuleNode {
+ public:
+  /*!
+   * \brief The ethos runtime module.
+   *
+   * \param cmms A array of external symbol 1, serialized command stream 1
+   * external symbol 2, serialized command stream 2, ....
+   * TODO : if and when FFI support Maps with non-objects OR compound arrays
+   * switch to that.
+   */
+  explicit EthosUModuleNode(const String& func_name_, const String& cmms_hex_,
+                            const String& weights_bias_hex_, const Integer& scratch_size_,
+                            const Integer& input_size_, const Integer& output_size_) {
+    func_names_.push_back(func_name_);
+    cmms_hex = std::move(cmms_hex_);
+    weights_bias_hex = std::move(weights_bias_hex_);
+    scratch_size = scratch_size_->value;
+    input_size = input_size_->value;
+    output_size = output_size_->value;
+    c_source = GenerateSource();
+  }
+
+  /*!
+   * \brief Save the module to file.
+   *
+   * \param file_name The file to be saved to.
+   * \param format The format of the file.
+   */
+  void SaveToFile(const std::string& file_name, const std::string& format) final {
+    std::string fmt = GetFileFormat(file_name, format);
+    LOG(INFO) << "format=" << fmt << ";;\n";

Review comment:
       This looks like some debug logging that was left in by mistake.
   It should probably be removed.




-- 
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: commits-unsubscribe@tvm.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org