Over in the circt project, the verifier (in
-verify-each mode) is slower than the rest of the compiler. While we could turn off -verify-each, I like the bug finding ability of it, and would prefer to go as far as we can without doing this.
There are a few ways to speed up the verifier, but the lowest hanging fruit is to parallelize it. Particularly for module passes, it would be nice to verify each function in parallel with each other.
There are a couple of concerns about this: 1) while verification hooks are generally read only, we don’t actually have a declared policy about this. 2) the granularity of an individual verify call on an op is so small that we may run into more orchestration overhead than we benefit from parallelization.
I think the answer to this it do an “effective in practice” hack of some sort. The
OperationVerifier::verifyOpAndDominance method in Verifier.cpp walks the region tree of the IR, recursively verifying an op before its enclosed regions in preorder (it actually has two different passes one for op verification one for dominance, but that’s a detail I’ll ignore here).
In order to address the granularity issue, I think we can have the verifier parallelize the verification of the top-most region that contains “isolated from above” ops. This would ensure that functions get verified in parallel, and addresses the (fairly theoretical) concurrency issue by aligning with our existing parallelization strategy for “isolated from above” ops.
Does anyone have any concerns about this, or a better idea?