How to calculate search space in auto scheduler(ansor)

In autotvm 1.0,it has a way to get search space in task using ConfigSpace but i don’t found a way to search space in auto scheduler. Even though osdi20 paper mentions that the search space is large, it does not mention the specific size. Is there any way to measure this?

There’s no existing API to report the total space, because the tuning space is generated on the fly. However, it’s totally possible to write an API to calculate the space.

The total space would be the sum of the space of each schedule sketch, and the space of each schedule sketch is determined by the rules of initial sampling and evolutionary search. We could add an API (e.g., size) to the rules so that we could build a space calculation API for the given task.

1 Like

It is not easy to calculate the size of the search space of Ansor.

The search space of Autotvm is a multi-dimensional grid, so we can easily compute the total size by multiplying the lengths of all dimensions.

The search space of Ansor is a tree. In order to compute the total size, we have to traverse the tree and sum all leaf nodes. The tree hierarchy looks like (sketches → tiling sizes → compute locations → other knobs). This hierarchy is coupled with low-level implementations and has some non-trivial dependency. It is not an easy task but you can give it a try.

1 Like

So do you add this api .size now?

And I am wondering, you said the tuning space is generated on the fly. It’s that means in every search iteration, the program sampler will generate a batch of random sketches and their annotations from the tensor expression?