Skip to main content

Module observer

Module observer 

Expand description

Watching the fusion server register operations and run blocks of them.

Fusion decouples when an operation is recorded from when its work runs: an operation is registered as the program reaches it and executed later, inside a block — one fused kernel’s worth of operations, or one operation run unfused — once something seals the segment it sits in. A block can run long after its operations were registered, out of registration order, and it can hold operations the program registered in quite different places. A caller attributing device work to what the program was doing cannot read that off the kernel launches alone.

A FusionObserver, installed with a FusionObservation, sees both halves, on the server’s thread: registered for every operation as it is registered, before anything it triggers runs, and block_starts / block_ran around every block, with the operations it covers. Every kernel a block launches is issued on that thread between the two, so an observer that pairs each operation with its own state at registration can say, for any launch, which operations it carried out.

§Cost

One relaxed atomic load per registration and per block when nothing is installed, which is every ordinary run. An observed block hands over the operations where the server already holds them, so nothing is gathered for it.

Structs§

BlockOperations
The operations one block covers, in the order it runs them: the operations one fused kernel replaces, or the one operation an unfused block runs.
FusionObservation
Watches the fusion server for as long as it lives.

Traits§

FusionObserver
Notified of every operation the fusion server registers and every block of them it runs, on the server’s thread.