Description
When debugging the annotations framework, it is sometimes a bit annoying that all exceptions are caught but using -assert_compiler_success
is not possible for all scripts. I suppose debugging for other parts might have similar issues.
Here, I try to identify the underlying root cause and suggest a possible approach to handle exceptions in a better way.
Current Situation
The flag --assert_compiler_success
can be used to require that compilation is successful. Success solely requires that no exceptions was caught (at a certain program point) and does not claim anything about parallelization. For the test cases in script_microbenchmarks
from compiler/test_evaluation_scripts.py
, some parts of the regions simply cannot be parallelized, e.g. because of side effects and the "compiler"/parallelization transformations do not fail here in the sense of something has actually gone wrong. Nevertheless, running pa.sh with --assert_compiler_success
fails and does not output anything since having side effects yields an exception that is caught at the same point as other exceptions.
For debugging, it would be good to be able distinguish why the transformation failed: because of "unparallelizability" (I) (like side effects) or other issues like IndexError
or ValueError
(II).
Suggestion
We could define a dedicated class for Exceptions from (I), throw these at the respective places and catch them before catching all other exceptions which would also cover (II).
It seems to make sense to change the behavior of --assert_compiler_success
to only report exceptions (II).
To get reports for (I) when debugging, one could simply uncomment/introduce traceback.print_exc()
, which is basically what I do currently for all exceptions, or we could add another flag for that as well.