Skip to main content

Module execution

Module execution 

Source
Expand description

What the process does with the work it is asked to run, and what that work triggered.

Two levels decide what a launch does. The ProcessMode is the whole process’s, on every device: it is where the state it governs lives — each server’s compile queue, the tune cache keyed by tune key, measurements any other work on a device would skew, pages shared across streams. A stream only knows whether its launches run, its StreamMode: the process mode sets every stream’s default, and a measurement — autotune’s candidates, a throughput probe — switches the stream it measures on to StreamMode::Execute while it measures. The stream never knows why.

Under ProcessMode::CompileOnly every launch and every tune’s candidates only queue their kernels, so a pass gathers everything a workload and its tuning reach; nothing compiles until a later launch loads a kernel — the first of a CompileAndAutotune pass, or the first tune before it measures — which compiles the whole queue in one batch. Under CompileAndAutotune every launch compiles its kernel and is discarded, and the tunes measure. A workload then pays for compilation and tuning without paying for the work that provoked them, which is what makes producing a shippable environment affordable.

A ProcessModeOverride counts what it triggers into a StatisticsCollector, which a StatisticsReader reads from any thread: the kernels obtained and the tunes measured, counted to it by the code doing the work, on every device.

Buffers are left as they were under either process mode that discards launches, so anything read back is meaningless. It only suits a pass driven by the shapes it produces, which is what keys the caches, and never one that branches on a computed value.

The verdict is resolved where the launch is issued, on the stream it goes out on, and handed to the server as a LaunchMode.

Re-exports§

pub use statistics::AutotuneStatistics;
pub use statistics::CompilationStatistics;
pub use statistics::ExecutionStatistics;
pub use statistics::StatisticsCollector;
pub use statistics::StatisticsReader;

Structs§

AutotuneStatistics
The autotune keys tuned under a collector’s overrides. A key with one candidate is answered, not tuned, and counts nowhere.
CompilationStatistics
The kernels the launches under a collector’s overrides obtained.
ExecutionStatistics
A snapshot of what a collector’s overrides triggered. Every count only grows, over every override and on every device.
ProcessModeOverride
Applies a process mode to the whole process while it lives, counting what it triggers into a collector, on every thread and every device.
StatisticsCollector
Collects what the overrides opened with it triggered.
StatisticsReader
Reads a StatisticsCollector’s statistics from any thread, and opens nothing.
StreamModeOverride
Sets the mode of one client’s stream on its device while it lives, restored on drop: what a measurement opens, so its launches run whatever the process mode discards.

Enums§

LaunchMode
What a server does with one launch: the verdict its stream’s mode and the process mode resolve to.
ProcessMode
What the process does with the work it is asked to run.
StreamMode
Whether a stream’s launches run.