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 2022/06/08 08:02:59 UTC
[GitHub] [tvm] junrushao1994 opened a new pull request, #11622: [MetaSchedule] Developer Ergonomics Enhancement
junrushao1994 opened a new pull request, #11622:
URL: https://github.com/apache/tvm/pull/11622
Per discussion with @Kathryn-cat
- [x] Move `initialize_with_tune_context` as private API `_initialize_with_tune_context`
- [x] Instead of using bunch of import statements, encourage using `ms.xxx` as the prefix (e.g. `ms.database.MemoryDatabase`) to organize things better
- [ ] Move `defaults` to a separate file and make it more discoverable
- [ ] Delegate class members' methods in `TuneContext`
--
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
[GitHub] [tvm] Kathryn-cat commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
Kathryn-cat commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r893984627
##########
python/tvm/meta_schedule/tune_context.py:
##########
@@ -132,5 +134,108 @@ def __init__(
def initialize(self):
"""Initialize the tuning context"""
-
_ffi_api.TuneContextInitialize(self) # type: ignore # pylint: disable=no-member
+
+ def generate_design_space(self, mod: IRModule) -> List[Schedule]:
Review Comment:
I think `mod` here can be omitted (or set as optional) because we use `context.mod` as default.
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894009966
##########
python/tvm/meta_schedule/tune_context.py:
##########
@@ -132,5 +134,108 @@ def __init__(
def initialize(self):
"""Initialize the tuning context"""
-
_ffi_api.TuneContextInitialize(self) # type: ignore # pylint: disable=no-member
+
+ def generate_design_space(self, mod: IRModule) -> List[Schedule]:
Review Comment:
Good catch!! Sorry I overlooked the possibility of taking `mod` directly from `TuneContext`!
--
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
[GitHub] [tvm] zxybazh commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
zxybazh commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894018181
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
`DefaultConfig` seems a bit similar to `TuneConfig`, the functions inside actually provides a pretty good source for modules required for tuning. What about `DefaultModules`?
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894055999
##########
src/meta_schedule/tune_context.cc:
##########
@@ -70,6 +70,82 @@ void TuneContextNode::Initialize() {
}
}
+void TuneContextNode::_GenerateMeasureCandidates() {
+ ICHECK(this->search_strategy.defined());
+ this->measure_candidates = this->search_strategy.value()->GenerateMeasureCandidates();
+}
+
+void TuneContextNode::_SendToBuilder(const Builder& builder) {
+ Array<MeasureCandidate> candidates = this->measure_candidates.value();
Review Comment:
Thanks! That's a good point!
--
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
[GitHub] [tvm] Kathryn-cat commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
Kathryn-cat commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r893972667
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
Currently `DefaultLLVM` and `DefaultCUDA` have no inheritance relationship with `Default`, so I think it might be better to move `DefaultLLVM` and `DefaultCUDA` into `Default` as subclasses, and give them the same names for functions. Also, the name `Default` is actually a little misleading. Perhaps change it into others like `Config`?
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
Currently `DefaultLLVM` and `DefaultCUDA` have no inheritance relationship with `Default`, so I think it might be better to move `DefaultLLVM` and `DefaultCUDA` into `Default` as subclasses, and give them the same names for functions. Also, the name `Default` is actually a little misleading. Perhaps change it into others like `Config`?
--
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
[GitHub] [tvm] Kathryn-cat commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
Kathryn-cat commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894045639
##########
src/meta_schedule/tune_context.cc:
##########
@@ -70,6 +70,82 @@ void TuneContextNode::Initialize() {
}
}
+void TuneContextNode::_GenerateMeasureCandidates() {
+ ICHECK(this->search_strategy.defined());
+ this->measure_candidates = this->search_strategy.value()->GenerateMeasureCandidates();
+}
+
+void TuneContextNode::_SendToBuilder(const Builder& builder) {
+ Array<MeasureCandidate> candidates = this->measure_candidates.value();
Review Comment:
It might be helpful to add a function for manually adding `measure_candidates`, since sometimes the field is empty after running search algorithms.
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894027106
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
> `DefaultConfig` seems a bit similar to `TuneConfig`, the functions inside actually provides a pretty good source for modules required for tuning. What about `DefaultModules`?
Yeah it does sound similar but I find `DefaultModules` less recognizable...Let's find a better name together!
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894068998
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
Thanks!!
--
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
[GitHub] [tvm] junrushao1994 commented on pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on PR #11622:
URL: https://github.com/apache/tvm/pull/11622#issuecomment-1150753686
To avoid the PR being overly huge, we decided to upstream the rest of the enhancement as a separate PR.
--
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
[GitHub] [tvm] Kathryn-cat commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
Kathryn-cat commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894052428
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
> Therefore, I would love to propose an alternative:
The alternative makes sense to me. I think we can go ahead and remove the `Default` class.
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
> Therefore, I would love to propose an alternative:
The alternative makes sense to me. I think we can go ahead and remove the `Default` class.
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894061713
##########
src/meta_schedule/tune_context.cc:
##########
@@ -70,6 +70,82 @@ void TuneContextNode::Initialize() {
}
}
+void TuneContextNode::_GenerateMeasureCandidates() {
+ ICHECK(this->search_strategy.defined());
+ this->measure_candidates = this->search_strategy.value()->GenerateMeasureCandidates();
+}
+
+void TuneContextNode::_SendToBuilder(const Builder& builder) {
+ Array<MeasureCandidate> candidates = this->measure_candidates.value();
Review Comment:
added
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894062277
##########
python/tvm/meta_schedule/tune_context.py:
##########
@@ -132,5 +134,108 @@ def __init__(
def initialize(self):
"""Initialize the tuning context"""
-
_ffi_api.TuneContextInitialize(self) # type: ignore # pylint: disable=no-member
+
+ def generate_design_space(self, mod: IRModule) -> List[Schedule]:
Review Comment:
updated :-)
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894013167
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
> Also, the name `Default` is actually a little misleading. Perhaps change it into others like `Config`?
Good point! I'm a bit unsure about `Config` alone though given somehow it didn't convey that it's the default configuration. What about `DefaultConfig`?
--
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
[GitHub] [tvm] junrushao1994 merged pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 merged PR #11622:
URL: https://github.com/apache/tvm/pull/11622
--
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
[GitHub] [tvm] junrushao1994 commented on a diff in pull request #11622: [MetaSchedule] Developer Ergonomics Enhancement
Posted by GitBox <gi...@apache.org>.
junrushao1994 commented on code in PR #11622:
URL: https://github.com/apache/tvm/pull/11622#discussion_r894020602
##########
python/tvm/meta_schedule/default.py:
##########
@@ -0,0 +1,327 @@
+# 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.
+# pylint: disable=import-outside-toplevel
+"""Pre-configured Defaults for MetaSchedule search rules"""
+import logging
+from os import path as osp
+from typing import Callable, Dict, List, Optional, Union
+
+from tvm._ffi.registry import register_func
+from tvm.ir import IRModule
+from tvm.target import Target
+from tvm.tir import PrimFunc
+
+from .builder import Builder, LocalBuilder
+from .cost_model import CostModel, XGBModel
+from .database import Database, JSONDatabase
+from .feature_extractor import PerStoreFeature
+from .measure_callback import MeasureCallback
+from .mutator import Mutator
+from .postproc import Postproc
+from .runner import LocalRunner, Runner
+from .schedule_rule import ScheduleRule
+from .space_generator import PostOrderApply, SpaceGenerator
+
+logger = logging.getLogger(__name__) # pylint: disable=invalid-name
+
+FnSpaceGenerator = Callable[[], SpaceGenerator]
+FnScheduleRule = Callable[[], List[ScheduleRule]]
+FnPostproc = Callable[[], List[Postproc]]
+FnMutatorProb = Callable[[], Dict[Mutator, float]]
+
+
+class Default:
Review Comment:
> Currently DefaultLLVM and DefaultCUDA have no inheritance relationship with Default, so I think it might be better to move DefaultLLVM and DefaultCUDA into Default as subclasses, and give them the same names for functions
Generally speaking i'm a big fan of subclassing-based approach, but in this particular case, I'm not 100% sure this is the most straightforward approach, and the fundamental reasons here are:
1) `Default` is the only interface that interacts with end users, while `DefaultLLVM` and `DefaultCUDA` are not supposed to be directly used;
2) Here classes with static methods are only used without instantiating objects, i.e. more like namespaces. On the other hand, inheritance helps more in instantiated objects (admittedly though it does hide static methods from parent, but it's a bit less straightforward).
Indeed, the three default classes are a bit misleading. Therefore, I would love to propose an alternative:
1) Remove `Default` class and pull all its methods out as global methods, which end users are encouraged to use. For example:
```python
from tvm import meta_schedule as ms
ms.default_config.schedule_rules()
```
2) Rename `DefaultLLVM` -> `_DefaultLLVM`, `DefaultCUDA` -> `_DefaultCUDA` to stress both are private implementation.
Let me know what you think!
--
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