Skip to content

Commit

Permalink
manual -> fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
masahi committed Apr 2, 2022
1 parent 86d7060 commit c5ff0fe
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion python/tvm/meta_schedule/testing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@
DummyRunner,
DummyRunnerFuture,
DummyMutator,
apply_manual_schedules,
apply_fixed_schedules,
)
8 changes: 4 additions & 4 deletions python/tvm/meta_schedule/testing/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,19 +118,19 @@ def apply(self, trace: Trace, _) -> Optional[Trace]:
return Trace(trace.insts, {})


def apply_manual_schedules(
def apply_fixed_schedules(
relay_mod: Union[RelayFunc, IRModule],
target: Union[str, Target],
params: Optional[Dict[str, NDArray]],
schedule_fn: Callable[[ExtractedTask, Schedule], bool],
):
"""Apply manual schedules as specified by schedule_fn to extracted tasks,
and return a database that can be passed to ApplyHistoryBest.
"""Apply fixed schedules (manually written, without any tunable knobs) as specified by
schedule_fn to extracted tasks, and return a database that can be passed to ApplyHistoryBest.
Parameters
----------
mod : Union[RelayFunc, IRModule]
The Relay module to apply manual schedules.
The Relay module to apply fixed schedules.
target : Union[str, Target]
The target used to extract tasks.
params : Optional[Dict[str, tvm.runtime.NDArray]]
Expand Down
4 changes: 2 additions & 2 deletions tests/python/unittest/test_meta_schedule_multi_anchor.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
import tvm
import tvm.testing
from tvm import relay
from tvm.meta_schedule.testing import apply_manual_schedules
from tvm.meta_schedule.testing import apply_fixed_schedules
from tvm.meta_schedule.integration import ApplyHistoryBest


Expand Down Expand Up @@ -81,7 +81,7 @@ def schedule_fn(task, sch):
return True
return False

database = apply_manual_schedules(relay_mod, target, params, schedule_fn)
database = apply_fixed_schedules(relay_mod, target, params, schedule_fn)

with ApplyHistoryBest(database):
with tvm.transform.PassContext(
Expand Down
10 changes: 6 additions & 4 deletions tests/python/unittest/test_meta_schedule_tune_relay.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
from tvm.meta_schedule.database import JSONDatabase, PyDatabase, TuningRecord, Workload
from tvm.meta_schedule.integration import ApplyHistoryBest
from tvm.meta_schedule.testing.relay_workload import get_network
from tvm.meta_schedule.testing import apply_manual_schedules
from tvm.meta_schedule.testing import apply_fixed_schedules
from tvm.meta_schedule.tune import (
extract_task_from_relay,
tune_extracted_tasks,
Expand Down Expand Up @@ -149,6 +149,7 @@ def test_meta_schedule_tune_relay(
config=ReplayTraceConfig(
num_trials_per_iter=32,
max_trials_per_task=32,
max_trials_global=32,
),
work_dir=work_dir,
database=JSONDatabase(
Expand Down Expand Up @@ -490,8 +491,9 @@ def manual_tir_common(do_tune=False):
)
)
config = ReplayTraceConfig(
num_trials_per_iter=64,
num_trials_total=64,
num_trials_per_iter=32,
max_trials_per_task=32,
max_trials_global=32,
)

with tempfile.TemporaryDirectory() as work_dir:
Expand All @@ -517,7 +519,7 @@ def schedule_fn(task, sch):

return True

database = apply_manual_schedules(relay_mod, target, params, schedule_fn)
database = apply_fixed_schedules(relay_mod, target, params, schedule_fn)

with ApplyHistoryBest(database):
with tvm.transform.PassContext(
Expand Down

0 comments on commit c5ff0fe

Please sign in to comment.