cuda module#
The cuda module is the heart of eagle: it records a stream of kernel
launches once, assembles them into a CUDA dependency graph, and replays the
instantiated graph, re-tuning a launch’s geometry without rebuilding it. It also
provides RAII wrappers for the underlying CUDA stream / event primitives.
Headers#
Header |
Contents |
|---|---|
|
|
|
|
|
|
|
|
|
Grid / thread-block sizing helper for kernel launches. |
|
|
|
|
|
|
|
Graph type traits. |
Capture, build, launch#
The canonical pattern captures a kernel launch, adds it as a graph node,
instantiates a Launcher, and replays it:
#include <eagle/eagle.h>
eagle::cuda::Stream stream;
eagle::cuda::Graph graph;
graph.stream(stream.cuda());
// Record a kernel launch into the graph
eagle::cuda::StreamCapturer capturer(stream.cuda());
capturer.begin();
myKernel<<<grid, block, 0, stream.cuda()>>>(args);
graph.addNode(eagle::cuda::CapturedGraph{ capturer.end() });
// Add a host callback that runs on the CPU
graph.addHostNode([&]() { /* post-process on CPU */ });
// Instantiate and replay
eagle::cuda::Launcher launcher = graph.launcher();
launcher.launch();
launcher.synchronize();
Re-tuning without re-capture#
setLogicalSize re-tunes the launch geometry of an instantiated graph
without rebuilding it, for replaying a batch whose
active-sample count changes between iterations.
Note
eagle defines CUDA_API_PER_THREAD_DEFAULT_STREAM=1 at compile time, so
stream 0 maps to each thread’s private default stream rather than the
legacy NULL stream.
See also
CUDA graphs — end-to-end CUDA-graph usage guide.
cuda API — full cuda API reference.