tristan-arm commented on a change in pull request #8300:
URL: https://github.com/apache/tvm/pull/8300#discussion_r691187911
##########
File path: python/tvm/relay/op/contrib/ethosn.py
##########
@@ -61,6 +61,53 @@ def partition_for_ethosn(mod, params=None, **opts):
-------
ret : annotated and partitioned module.
"""
+ if opts:
+ tops = opts.get("tops", None)
+ ple_ratio = opts.get("ple_ratio", None)
+ sram_size = opts.get("sram_size", None)
+ if tops or ple_ratio or sram_size:
+ raise ValueError(
+ "Setting tops, ple_ratio or sram_size has no effect when
targeting Ethos-N77"
+ )
+
+ if params:
+ mod["main"] = bind_params_by_name(mod["main"], params)
+
+ seq = tvm.transform.Sequential(
+ [
+ transform.InferType(),
+ transform.MergeComposite(pattern_table()),
+ transform.AnnotateTarget("ethos-n"),
+ transform.MergeCompilerRegions(),
+ transform.PartitionGraph(),
+ ]
+ )
+
+ return seq(mod), None
+
+
+def partition_for_ethosn78(mod, params=None, **opts):
+ """Partition the graph greedily offloading supported
+ operators to Arm Ethos-N NPU.
+
+ Parameters
+ ----------
+ mod : Module
+ The module to run passes on.
+ params : Optional[Dict[str, NDArray]]
+ Constant input parameters.
+
+ Returns
+ -------
+ ret : annotated and partitioned module.
+ """
+ config = opts
Review comment:
Fixed now.
##########
File path: python/tvm/driver/tvmc/composite_target.py
##########
@@ -23,7 +23,8 @@
import tvm.contrib.target.vitis_ai # pylint: disable=unused-import
from tvm.relay.op.contrib.arm_compute_lib import partition_for_arm_compute_lib
-from tvm.relay.op.contrib.ethosn import partition_for_ethosn
+from tvm.relay.op.contrib.ethosn import partition_for_ethosn77
+from tvm.relay.op.contrib.ethosn import partition_for_ethosn78
Review comment:
Fixed now.
##########
File path: src/relay/backend/contrib/ethosn/ethosn_utils.h
##########
@@ -0,0 +1,49 @@
+/*
+ * 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/relay/backend/contrib/ethosn/ethosn_utils.h
+ * \brief Ethos-N utility functions.
+ */
+
+#ifndef TVM_RELAY_BACKEND_CONTRIB_ETHOSN_ETHOSN_UTILS_H_
+#define TVM_RELAY_BACKEND_CONTRIB_ETHOSN_ETHOSN_UTILS_H_
Review comment:
Done
--
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]