kokkos-tools
kokkos-tools copied to clipboard
Sampling overlay prototype
Based on kokkos/kokkos#3812
One hope I have for that design is that our simple tools can be given complex capabilities using "overlays," (a concept I'm shamelessly stealing from @nmhamster and @jrmadsen ). This PR introduces some infrastructure to enable that concept, and two example overlays.
First, I formalized the process for forwarding your callbacks to a next tool, using a "callback_chainer" struct, which handles loading a next library, grabbing callbacks, all that mess.
The first example overlay is a trivial "passthrough" overlay. All it does is forward events, I basically used it to prove out the callback_chainer thing.
The other is a sampler overlay. This turns off Kokkos global fencing, and then every 101 kernel invocations (that should be a settable parameter) it forwards the kernel to an underlying tool. Fences are only introduced in the case where the kernel is profiled. I've tested this with the space-time-stack and TAU (TAU through modifying tau_exec).
What's neat here is that space-time-stack is completely unmodified, but gets this sampling capability "for free." It's kind of a deeply weird version of a modular tools framework.
Not sure how I feel about this design as a thing to merge, mainly just putting it up as another proof of concept for the Core PR