As we start to build multiple modules, it is useful to start modularizing the unit-tests with a goal of reducing some of the actual integration tests. Previously quite a few tests are written in a way that directly invokes end to end compilation, we also have tests that are coupled with legacy te pipeline. There are several issues, some of the tests running slow, and when regression happens it is harder to find out why since the tests are not unit tests in nature.
While sometimes some related tests are necessary and we would like to keep some legacy tests for a bit. It is important to move to a more unit-testing regime for new tests, and explicitly mark(group) tests that involves end to end execution (and slower). Having tests in different folder also helps us think more carefully about module boundaries. Of course we still want to be pragmatic and not too pedantic. For example, we still love the python first infra that helps us productively write tests, and some level of coupling is useful for us to productively write tests.
To keep things simple, I would like us to try get things moving starting with one module (TensorIR). Here is how we can incrementally do that for TensorIR (and use this as an example).
- Start with a new folder
tests/python/tir
- Put new TensorIR unit-tests into this folder
- Migrate some test cases from existing ones into this folder, with the following goals
- Always use TVMScript/IRBuilder before/after to unit test each pass
- Avoid calling the build pipeline
- For those that involves build e2e pipeline
- Move to an explicit folder
tests/python/integration/tir
- OK to include some for target specific generation, in this case, start from (scheduled) TVMScript
- Ensure such generation are fast (<1min)
- Have an explicit naming pattern
test_e2e_xxx
- Move slow tests into a separate folder
tests/python/slow/tir
- Move to an explicit folder
Everything should work as it is. Of course we can still leave some legacy tests in the old place and once we done modularizing, we also would have a clear picture of things