Constraints on the AutoTVM search space


#1

Hi,

How do we constraint the search space so that only a few options out of the cross-product of “knobs” are used?
An example to clarify the question:
MCBs = [56, 64]
NCBs = [32, 24]
configs = autotvm.get_config()
configs.define_knob(“MCBs”, MCBs)
configs.define_knob(“NCBs”, NCBs)

I want configs (MCB, NCB) -> [(56, 32), (56, 24), (64, 24)] to be used but not (64, 32). Is there a way to create such constraints on the products on the search spaces?

Thanks


#2

Currently I do not think we support this use case but it should not be too difficult to add a method to add a user-defined function to ConfigSpace: https://github.com/dmlc/tvm/blob/8d3b392da6eae59dab068947e76ddf9e3534661d/python/tvm/autotvm/task/space.py#L579.

However in the past we have not really needed these types of constraints as it is the job of the tuner to deduce nontrivial constraints, and it will quickly learn around trivial constraints (e.g., violating hardware resources as they will raise errors during tuning).