Skip to main content

Module fallback

Module fallback 

Source
Expand description

How often a kernel took the row at a time path, and for which shape of input.

spec/engine/03-data-plane.md asks for this by name, and the reason is that the alternative to counting is guessing. There are four physical forms, so sixteen form pairs per kernel, and writing a hand tuned loop for all sixteen is both a lot of code and a lot of places for a wrong answer to hide. Writing three of them and a correct slow path for the rest is the right amount of code, but only if there is a way to find out that the fourth is on the hot path of a real query. That way is this.

What gets counted is the fall through, not the fast path. A counter on the fast path would cost an atomic increment per vector on the loop this whole layer exists to make fast, and it would measure something nobody needs to know. A counter on the slow path costs an atomic increment on a loop that is already allocating a Value per row, which is not measurable next to what it sits on.

The counts are process wide and never reset by the library. A benchmark harness reads them at the end of a run and prints the ones that are not zero, which turns “we should probably specialize sequence against constant” into either a number or silence.

There is a second counter and record bumps both. This one answers which form pair to go and write a specialization for, which is a question about a build rather than about a query, so it is process wide and has no idea which operator was running. rudb_common::slow answers which operator in this query is the one paying, which needs the count to be per thread so that the instrumentation shim can take a difference around a call. Neither number can be worked out from the other, they cost an add each, and the alternative to having both is reading one of them and guessing the other.

Enums§

Kernel
Which kernel fell through.

Functions§

count
How many times a kernel fell through on this pair of forms.
hot
Every combination that has fallen through at least once, most frequent first.
record
Records that a kernel took the row at a time path on this pair of forms.
report
The counts as a table, or a line saying there are none.
reset
Sets every counter back to zero.