areusch commented on a change in pull request #8113:
URL: https://github.com/apache/tvm/pull/8113#discussion_r665548173



##########
File path: python/tvm/autotvm/measure/measure_methods.py
##########
@@ -235,13 +236,30 @@ def __init__(
         self.number = number
         self.repeat = repeat
         self.min_repeat_ms = min_repeat_ms
+        self._ref_input = None
 
         self.enable_cpu_cache_flush = enable_cpu_cache_flush
         self.cooldown_interval = cooldown_interval
         self.module_loader = module_loader
 
         self.executor = LocalExecutor(timeout=timeout * (self.n_parallel + 1))
 
+    @property
+    def ref_input(self):
+        """Fixed input for tuning special operators."""

Review comment:
       could you qualify "special" (explain it is for operators that cannot 
handle random input)

##########
File path: python/tvm/autotvm/measure/measure.py
##########
@@ -184,6 +184,8 @@ def measure_option(builder, runner):
         Specify how to build programs
     runner: Runner
         Specify how to run programs
+    ref_input: list of np.arrays

Review comment:
       apologies but on looking at this change in code now, i think it may be a 
bit too fine-grained to add directly to measure_option. it seems like we should 
either encapsulate the per-tuning-run options in an e.g. `operator_opts` kwarg 
to measure_option or just keep them in RPCRunner for now. it seems like if we 
continue with this pattern, we'd want to do an `operator_opts` reorganization 
at some future point anyhow, so i'd rather not start down that path for one 
option right now. i suggest we stick with the RPCRunner property for now then, 
and improve the interface as we add more options. what do you think?

##########
File path: tests/python/unittest/test_autotvm_measure.py
##########
@@ -60,8 +62,24 @@ def test_task_tuner_without_measurement_spawn():
     p.join()
 
 
+def test_task_runner_with_ref_input():
+    """test runner ref_input without measurement"""
+    refinp = [np.random.rand(128, 128) for i in range(3)]
+    measure_option = autotvm.measure_option(builder="local", runner="local", 
ref_input=refinp)
+
+    class DummyExecutor(measure.executor.Executor):
+        def submit(self, func, *args, **kwargs):
+            sig = 
Signature.from_callable(measure.measure_methods.run_through_rpc)
+            assert sig.bind(*args, **kwargs).arguments["ref_input"] == refinp

Review comment:
       can you set a variable here in the outer 
`test_task_runner_with_ref_input` (e.g. `ran_dummy_executor = True`) and then 
assert on that in the test to ensure that this function and assert ran?




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