My guess is that the Dafny process that is feeding the Z3 processes has some major optimization opportunities.
First my guess is that controlling the number of files being inlined and linearized will help.
But my guess is that the larger optimization has to do with how Dafny process some source to send it to Z3.
If you flip the way you handle this so that instead of trying to verify all the files at once you verify a single file at a time,
you get much better performance in the aggregate.
Our project basically include all the Dafny, so if you verify one file or all the files the same amount of Dafny is loaded.
And yet with the overhead of all that running a process per file is much faster once you have a few cores available.
I suspect that the process of cleaning up and sorting "stuff" before building the boogie operates on all files to verify. Even though only a small subset of that is sent to Z3. This is why sending lots of files to verify results in so much overhead.
I would like to debug this, but on the most recent Dafny version. Once your project updates to the latest Dafny version, please ping this issue so we can look at it again.
Dafny version
4.x
Code to produce this issue
Command to run and resulting output
We used to verify many files at once and use the
cores
option to parallelize. However this only controls how many Z3 processes are spawned.For large projects even with fast verification this takes much longer than expected.
For example: https://github.com/aws/aws-cryptographic-material-providers-library-dafny/actions/runs/6487004883/job/17616386544
See: push-ci-verification / verification (AwsCryptographicMaterialProviders, macos-latest) succeeded yesterday in 46m 37s
What happened?
My guess is that the Dafny process that is feeding the Z3 processes has some major optimization opportunities. First my guess is that controlling the number of files being inlined and linearized will help.
But my guess is that the larger optimization has to do with how Dafny process some source to send it to Z3. If you flip the way you handle this so that instead of trying to verify all the files at once you verify a single file at a time, you get much better performance in the aggregate.
Our project basically include all the Dafny, so if you verify one file or all the files the same amount of Dafny is loaded. And yet with the overhead of all that running a process per file is much faster once you have a few cores available.
I suspect that the process of cleaning up and sorting "stuff" before building the boogie operates on all files to verify. Even though only a small subset of that is sent to Z3. This is why sending lots of files to verify results in so much overhead.
Our current verification target now looks like this https://github.com/aws/aws-cryptographic-material-providers-library-dafny/blob/main/SharedMakefileV2.mk#L81
What type of operating system are you experiencing the problem on?
Mac