kokkos / kokkos-tools

Kokkos C++ Performance Portability Programming Ecosystem: Profiling and Debugging Tools
Other
109 stars 55 forks source link

Add kp_functor_size: print parallel functor sizes #242

Open cwpearson opened 7 months ago

cwpearson commented 7 months ago

Prints the count, size, and name of functors passed to Kokkos parallel regions.

cwpearson commented 7 months ago

Corresponding Core PR: https://github.com/kokkos/kokkos/pull/6844

vlkale commented 7 months ago

@crtrott I discussed this with Carl. Carl is using this for his work. This would also well-serve Kokkos Tools because it is a basis to have a generalized ToolState struct that the Kokkos Tools users can use to obtain profiling information per kernel invocation. This ToolsState came out of a discussion from @jrmadsen in #147.

I looked over this and it looks like the implementation is correct. The only question is whether we want to merge this, or if we want to provide a generalized tool callback than one marking the functor size - maybe something like kp_mark_kernel_info() (the kernel is indexed by the kernel ID passed in as a parameter to the function callback).

One note to consider (@cwpearson - we didn't discuss this) is that functor size is compile-time information and doesn't change dynamically at runtime. I wonder whether doing this in tool callbacks is the only way.

This PR forms the basis for dynamically changing information/properties of a Kokkos kernel.

cwpearson commented 7 months ago

@vlkale I changed the name of the callback to mark_kernel_static_info and defined a 512-byte struct, so while this currently only tracks functor size, it could be extended to include other info.

vlkale commented 7 months ago

@vlkale I changed the name of the callback to mark_kernel_static_info and defined a 512-byte struct, so while this currently only tracks functor size, it could be extended to include other info.

Great, thanks!