JIT: possibly revisit how we set assertion prop table size #10591
Labels
area-CodeGen-coreclr
CLR JIT compiler in src/coreclr/src/jit and related components such as SuperPMI
enhancement
Product code improvement that does NOT require public API changes/additions
Milestone
Some data on how often we drop assertions (from investigations into #10461, via pmi over fx):
Overall this doesn't seem too bad -- only about 0.16% of methods lost assertions from table size limits. I unfortunately didn't track how many of the size 64 cases were ones where we deliberately limited the size for throughput reasons.
Table size is determined by looking at
compILCodeSize
which will not take additions from inlining into account (among other things). So it seems like we perhaps could find a better size predictor.Or perhaps just allow the table to grow?
Here's a breakdown of how many methods would fit into our existing size bins:
Max number of assertions seen was 615 (in a method that used a size 64 table), in
Microsoft.CodeAnalysis.VisualBasic.VisualBasicCommandLineParser:Parse(ref,ref,ref,ref):ref:this
. So 551 of these were dropped.There is obviously some consideration of the overall cost of the subsequent dataflow analysis too, which is roughly proportional to max assertion size * number of blocks. So if we allow max assertion size to scale up with blocks we potentially see some quadratic behavior. But this seems perhaps solvable too -- we generate all (or more) assertions initially, and then only limit the ones we use if we see bad scaling.
This might let us also try and prioritize which assertions should survive, though I don't have any particular idea yet how to formulate that (something like the value number equivalent of weighted ref count usage ...?).
Note today we actually generate all assertions. Assertion gen doesn't early out once the table is full (though perhaps it should). It just stops recording assertions once the table fills up. So we are already paying the cost of finding all these assertions. And the table size itself is not a burden
So a rough proposal would be to find and record all assertions -- allowing the table to grow larger (with perhaps some size limit) and have a budget based on blocks * assertions, and, if over budget, start trimming assertions somehow to get under budget.
category:implementation
theme:assertion-prop
skill-level:intermediate
cost:medium
impact:small
The text was updated successfully, but these errors were encountered: