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 2020/09/06 23:32:13 UTC

[GitHub] [incubator-tvm] tqchen commented on a change in pull request #6369: [Target] Target Tags, Composite Target and Unified Interface

tqchen commented on a change in pull request #6369:
URL: https://github.com/apache/incubator-tvm/pull/6369#discussion_r484128192



##########
File path: python/tvm/target/target_tag.py
##########
@@ -0,0 +1,56 @@
+# Licensed to the Apache Software Foundation (ASF) under one

Review comment:
       rename to tag.py given that it is already under the target namespace

##########
File path: include/tvm/target/target_kind.h
##########
@@ -57,6 +52,8 @@ class TargetKindNode : public Object {
   int device_type;
   /*! \brief Default keys of the target */
   Array<String> default_keys;
+  /*! \brief Function used to preprocess on target creation */
+  PackedFunc preprocessor;

Review comment:
       Is it a common option? We can also make it available via set_attr instead

##########
File path: python/tvm/target/target_tag.py
##########
@@ -0,0 +1,56 @@
+# 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.
+"""Target tags"""
+from typing import Any, Dict
+from . import _ffi_api
+from .target import Target
+
+
+def list_tags() -> Dict[str, Target]:
+    """Returns a dict of tags, which maps each tag name to its corresponding target.
+
+    Returns
+    -------
+    tag_dict : Dict[str, Target]
+        The dict of tags mapping each tag name to to its corresponding target
+    """
+    return _ffi_api.TargetTagListTags()
+
+
+def add_tag(name: str, config: Dict[str, Any], override: bool = False) -> Target:
+    """Add a user-defined tag into the target tag registry.
+

Review comment:
       add an example

##########
File path: python/tvm/target/target_tag.py
##########
@@ -0,0 +1,56 @@
+# 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.
+"""Target tags"""
+from typing import Any, Dict
+from . import _ffi_api
+from .target import Target
+
+
+def list_tags() -> Dict[str, Target]:
+    """Returns a dict of tags, which maps each tag name to its corresponding target.
+
+    Returns
+    -------
+    tag_dict : Dict[str, Target]
+        The dict of tags mapping each tag name to to its corresponding target
+    """
+    return _ffi_api.TargetTagListTags()
+
+
+def add_tag(name: str, config: Dict[str, Any], override: bool = False) -> Target:

Review comment:
       register_tag?




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

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