Repository navigation
benchmark: add a task-overhead suite (tasks) - #788
Open
AnnaLena77 wants to merge 8 commits into
Open
AnnaLena77 wants to merge 8 commits into
AnnaLena77 wants to merge 8 commits into
Conversation
The array/linalg/sparse/stencil suites measure tile compute and data movement. None isolates the runtime's own per-task cost, which is what limits latency-bound programs (many small tasks, short dependent phases) and, under MPI, what every rank pays for tasks it never runs. The new "tasks" suite times, with microsecond task bodies and explicit ExactScope placement: round-robin and single-owner pinned spawns, unscoped spawns, a cross-owner dependent chain (hop latency), a pairwise fan-in tree, and a multi-phase exchange step (local stages, one small array per owner pair, a final local stage). A rank-local variant is included when MPI processors refuse DistributedAcceleration tasks. wait() does not rethrow a failed task, so a benchmark whose tasks all fail would 'run' in microseconds. Every benchmark is therefore checked once at a tiny size with fetch() when the suite is built, and skipped with a warning when it does not produce the expected value. Opt-in via BENCHMARK=tasks:dagger (not added to the default set).
… tasks that may throw The single-owner benchmark runs on the first owner, i.e. on the process that records the timing, so it measures the owner. Add a variant pinned to the last owner, where the recording process only has to plan the tasks, and variants whose bodies cannot be proven not to throw (concrete return type, may error), which is what most real task bodies look like and which take a different path under MPI than the provably non-throwing noop.
…odies that may throw
The tasks suite times what a task costs the runtime when its body does nothing. It does not say how large a task has to be before that cost stops mattering, and its numbers have no counterpart in other runtimes. Task Bench (Slaughter et al., SC20) answers both with METG, the minimum effective task granularity: the smallest task for which a system still reaches 50% of the machine's peak FLOP/s. The new "metg" suite runs Task Bench's METG experiment on Dagger. It ports the task graph (the dependence patterns of constant width), the validation of every task's inputs and the compute-bound kernel, sweeps the kernel's iteration count in powers of two with one benchmark per value, and adds a reference benchmark that runs one long kernel task on every processor at once, for the FLOP/s that efficiency is measured against. It follows the tasks suite: the same processor order, ExactScope placement unless BENCHMARK_METG_PLACEMENT=unscoped asks for the scheduler's, timed runs that wait and are then checked with fetch, a probe of every graph before it is timed, and opt-in selection (BENCHMARK=metg:dagger). Tasks are launched one Dagger.@Spawn at a time or, with BENCHMARK_METG_LAUNCH=bulk, a timestep at a time through Dagger.spawn_bulk. A task is credited with 128 FLOPs per kernel iteration, so the kernel has to run as fast as Task Bench's C kernel for the efficiency to be comparable. Written on tuples of scalars it compiled to mostly two-wide FMAs and reached 18 GFLOP/s on a core where the C kernel reaches 31; with an explicit <4 x double> FMA it reaches 31 as well.
The metg suite produces timings of whole task graphs. METG is derived from them: per kernel iteration count, the task granularity (elapsed * cores / tasks) and the efficiency (FLOP/s over the peak FLOP/s), and then the smallest granularity that is still at least 50% efficient. benchmark/metg.jl runs the suite through the orchestrator and computes these the way Task Bench's scripts/chart_metg.py does, including its interpolation at the threshold and its refusal of a sweep that does not bracket it. The peak defaults to the suite's reference run and can be given instead (BENCHMARK_METG_PEAK_FLOPS), as can the nodes and cores that Task Bench's accounting charges for. With BENCHMARK_METG_LOGDIR every sweep is also written as a log in Task Bench's report format, which chart_metg.py and the other chart scripts read directly. benchmark/metg_tests.jl pins the analysis to chart_metg.py: its expected values are what that script prints for the same data, in five accounting setups. It needs no packages (julia benchmark/metg_tests.jl).
Task Bench reports METG for one task graph and for four identical graphs run at once: 11 of the 39 chart commands in its scripts/render_all.sh use four. With one graph every processor has exactly one task per timestep; with several it has that many. BENCHMARK_METG_NGRAPHS selects the number of graphs, and a comma-separated list gives a sweep for each. The graphs are independent copies that advance together, timestep by timestep, as in Task Bench's Legion implementation, and column p of every graph maps to the same processor. A sweep's group key gains "graphs=N" only when N > 1, so the existing names do not change. The analysis counts ngraphs * steps * width tasks and writes the log the way Task Bench's core reports several graphs: every graph's configuration, then one set of totals. chart_metg.py -g 4 reads that log and arrives at the same METG; three such values are pinned in the tests.
The header listed the orchestrator's unrecorded warm-up run as a difference from Task Bench, whose implementations it called compiled ahead of time and so, by implication, not warmed up. Task Bench's MPI, Legion and HPX implementations run the whole graph once before the run they time (mpi/nonblock.cc, legion/main.cc, hpx/hpx_distributed.cc). Only the number of repetitions differs.
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This adds a benchmark suite that measures the runtime's own per-task cost, which the existing array, linalg, sparse and stencil suites do not isolate. It only touches
benchmark/; no source file changes.The suite
taskstimes microsecond task bodies with explicitExactScopeplacement: round-robin and single-owner pinned spawns, unscoped spawns, a cross-owner dependent chain (hop latency), a pairwise fan-in tree and a multi-phase exchange step. Variants whose bodies may throw are included, since most real task bodies look like that and they take a different path under MPI than a provably non-throwing no-op. A rank-local variant is included for communicators of size one.wait()does not rethrow a failed task, so a benchmark whose tasks all fail would finish in microseconds. Every benchmark is therefore checked once at a tiny size withfetch()when the suite is built, and skipped with a warning if it does not produce the expected value.The suite is opt-in (
BENCHMARK=tasks:dagger) and is not added to the default set. I would like to have it upstream because the scheduler pull requests that follow quote their numbers from it.AI disclosure: I prepared this change with the help of Claude (Anthropic) and reviewed it myself.
🤖 Generated with Claude Code