jacobbohlin commented on a change in pull request #9469:
URL: https://github.com/apache/tvm/pull/9469#discussion_r772546702



##########
File path: src/contrib/ethosu/cascader/graph.h
##########
@@ -0,0 +1,321 @@
+/*
+ * 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.
+ */
+
+/*!
+ * \file src/contrib/ethosu/cascader/graph.h
+ * \brief Graph objects (Tensor and Part) for the Ethos-U cascader
+ */
+#ifndef TVM_CONTRIB_ETHOSU_CASCADER_GRAPH_H_
+#define TVM_CONTRIB_ETHOSU_CASCADER_GRAPH_H_
+
+#include <tvm/runtime/data_type.h>
+#include <tvm/runtime/object.h>
+#include <tvm/te/operation.h>
+#include <tvm/te/tensor.h>
+
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include "propagator.h"
+
+namespace tvm {
+namespace contrib {
+namespace ethosu {
+namespace cascader {
+
+class Tensor;
+class Part;
+class StripeConfig;
+
+/*! \brief A struct to hold a Tensor Expression subgraph */
+struct TESubgraph {
+  /*! \brief The input te::Tensors to the subgraph */
+  std::vector<te::Tensor> input_tensors;
+  /*! \brief The output te::Tensor of the subgraph */
+  te::Tensor output_tensor;
+};
+
+/*! \brief Node to hold performance information for a Part */
+class PerformanceInfoNode : public Object {
+ public:
+  void VisitAttrs(AttrVisitor* v);
+
+  /*! \brief The cycles to compute a block */
+  size_t compute_cycles;
+  /*! \brief The number of bytes read per input tensor */
+  std::vector<size_t> read_bytes;
+  /*! \brief The number of bytes written to the output tensor */
+  size_t write_bytes;
+
+  static constexpr const char* _type_key = 
"contrib.ethosu.cascader.PerformanceInfo";
+  TVM_DECLARE_FINAL_OBJECT_INFO(PerformanceInfoNode, Object);
+};
+
+/*!
+ * \brief An class to hold the performance information for a Part.

Review comment:
       ```suggestion
    * \brief A class to hold the performance information for a Part.
   ```

##########
File path: src/contrib/ethosu/cascader/graph.h
##########
@@ -0,0 +1,321 @@
+/*
+ * 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.
+ */
+
+/*!
+ * \file src/contrib/ethosu/cascader/graph.h
+ * \brief Graph objects (Tensor and Part) for the Ethos-U cascader
+ */
+#ifndef TVM_CONTRIB_ETHOSU_CASCADER_GRAPH_H_
+#define TVM_CONTRIB_ETHOSU_CASCADER_GRAPH_H_
+
+#include <tvm/runtime/data_type.h>
+#include <tvm/runtime/object.h>
+#include <tvm/te/operation.h>
+#include <tvm/te/tensor.h>
+
+#include <unordered_map>
+#include <utility>
+#include <vector>
+
+#include "propagator.h"
+
+namespace tvm {
+namespace contrib {
+namespace ethosu {
+namespace cascader {
+
+class Tensor;
+class Part;
+class StripeConfig;
+
+/*! \brief A struct to hold a Tensor Expression subgraph */
+struct TESubgraph {
+  /*! \brief The input te::Tensors to the subgraph */
+  std::vector<te::Tensor> input_tensors;
+  /*! \brief The output te::Tensor of the subgraph */
+  te::Tensor output_tensor;
+};
+
+/*! \brief Node to hold performance information for a Part */
+class PerformanceInfoNode : public Object {
+ public:
+  void VisitAttrs(AttrVisitor* v);
+
+  /*! \brief The cycles to compute a block */
+  size_t compute_cycles;
+  /*! \brief The number of bytes read per input tensor */
+  std::vector<size_t> read_bytes;
+  /*! \brief The number of bytes written to the output tensor */
+  size_t write_bytes;
+
+  static constexpr const char* _type_key = 
"contrib.ethosu.cascader.PerformanceInfo";
+  TVM_DECLARE_FINAL_OBJECT_INFO(PerformanceInfoNode, Object);
+};
+
+/*!
+ * \brief An class to hold the performance information for a Part.
+ * \note The performance information for a Part is composed of 3 factors: the 
compute cycles,
+ * the number of bytes read from each input tensor and the number of bytes 
written to the output
+ * tensor. Bytes read/written is reported in favour of read/write bandwidth 
cycles so the
+ * calculation of the performance information can be re-used with different 
memory homing.
+ */
+class PerformanceInfo : public ObjectRef {
+ public:
+  PerformanceInfo(size_t compute_cycles, std::vector<size_t> read_bytes, 
size_t write_bytes) {
+    auto n = make_object<PerformanceInfoNode>();
+    n->compute_cycles = compute_cycles;
+    n->read_bytes = std::move(read_bytes);
+    n->write_bytes = write_bytes;
+    data_ = std::move(n);
+  }
+
+  TVM_DEFINE_OBJECT_REF_METHODS(PerformanceInfo, ObjectRef, 
PerformanceInfoNode);
+};
+
+/*! \brief Node to represent a Tensor */
+class TensorNode : public Object {
+ public:
+  void VisitAttrs(AttrVisitor* v);
+
+  /*! \return The shape of the tensor */

Review comment:
       What's the purpose of all these functions, as opposed to having public 
class members? 




-- 
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]


Reply via email to