Skip to content

Keep collective alias batches in uniform argument order - #848

Open
jpsamaroo wants to merge 4 commits into
masterfrom
jps/fix-mpi-alias-order
Open

jpsamaroo wants to merge 4 commits into
masterfrom
jps/fix-mpi-alias-order

Conversation

@jpsamaroo

Copy link
Copy Markdown
Member

MPI aliasing batches identify arguments by vector index, but constructing that vector from a Dict can assign different owners to an index on different ranks. A two-rank copy followed by collect then fails with reciprocal missing-alias answers, including on current master.

Reconstruct the first argument encounter order from the existing task metadata before collective batching. Keep the Distributed path unchanged and reuse membership scratch. Add mixed Float32/Float64/ComplexF64 and identity/triangular dependency regressions to the MPI CPU suite, plus deterministic ordering and inference checks.

Validation: 84 assertions across two MPI ranks with uniformity checks enabled, another 84 in the production-mode diagnostic, and 3 ordering/inference assertions pass. Five warmed samples at 4, 64 and 256 unique arguments retain the same allocation counts and bytes as the old vector construction. The extra traversal adds about 4.6 µs for 1,024 encounters on this host; this is a focused construction profile, not whole-region performance parity. Independent code and CI review follows.

Written by an AI agent on jpsamaroo's review feedback.

Argument hashes can contain process-local type hashes, so Dict values can put different owners at the same collective index on different ranks. Reconstruct first occurrence order from task metadata with reusable UInt membership scratch, leaving Distributed batching unchanged.

Exact master and AOT-parent two-rank copy/collect repros fail before. The repair passes84 mixed-type and identity/upper/lower dependency assertions with uniformity checks enabled, plus3 deterministic ordering/inference assertions. Five warmed1000-call profiles at4/64/256 unique arguments retain exactly the baseline allocation counts and bytes; scanning1024 encounters adds about4.6microseconds versus collecting the256 unique entries on this host.

Written by an AI agent on jpsamaroo's review feedback.
Use consistent operator and argument spacing, readable tuple/vector layouts, and the surrounding Markdown indentation so the regression tests and lesson are easy to review. Both test files retain identical parsed Julia expressions after removing line-location metadata; AGENTS.md retains the same words. No numerical or production code changes.

Written by an AI agent on jpsamaroo's review feedback.
Resolve the appended AGENTS.md lessons by preserving master content and the MPI alias-ordering lesson, renumbering that lesson and removing inherited trailing whitespace. Source and tests merge without conflicts.

Written by an AI agent on jpsamaroo's review feedback.
Resolve the append-only conflicts against c3352d7 without dropping either regression: keep master non-concrete-field and slot-metadata coverage, then retain the collective alias-order test unchanged. Preserve the existing ordered-batch implementation and MPI test while importing current master through an ordinary merge. Keep all maintainer lessons, renumber the alias-order lesson and retain the whitespace cleanup.

Validation: git diff --check passes; the old alias-order regression body and MPI fixture are unchanged, and the master slot-metadata include remains registered. Earlier independent unit/MPI controls remain historical; this merge has no new native or hosted-CI pass claim. The latest old-head benchmark allocation gate remains separate and unresolved.

Written by an AI agent on jpsamaroo's review feedback.
@github-actions

github-actions Bot commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Dagger benchmarks: dirty vs master

Counts are benchmark metrics (time, allocations, bytes). Timing changes require non-overlapping median ± IQR bands; both revisions need at least five timed samples, and timing regressions need an independent confirmation run. Allocation changes explicitly contradicted by that existing repeat are inconclusive; missing or neutral repeats retain the original allocation gate.

Backend Regressions Improvements Within noise Inconclusive metrics Suites
Threads 0 1 4 1 4/4
Distributed 2 0 1 3 4/4
Distributed+Threads 0 0 0 3 4/4
MPI 0 1 1 2 4/4
MPI+Threads 1 1 6 2 4/4
Total 3 3 12 11 20/20

Regressions across all backends

Backend Benchmark Metric Change
MPI+Threads linalg/dagger/N=256 (block 256)/matvec (A*x) time +36.6%
Distributed sparse/dagger/N=1024 (block 64)/spgemm (S*S) allocs +35.2%
Distributed sparse/dagger/N=1024 (block 64)/spgemm (S*S) memory +29.1%

Improvements across all backends

Backend Benchmark Metric Change
MPI array/dagger/N=1024 (block 128)/transpose (permutedims) time -43.4%
MPI+Threads stencil/dagger/N=256 (block 256)/neighbors (Clamp) time -43.2%
Threads linalg/dagger/N=1024 (block 128)/svd allocs -31.1%

Advisory allocation changes

Paired fixed-placement measurements gate Distributed CPU allocating LU counts and bytes and allocating X + X bytes. Review the advisory changes for costs specific to the allocating path. The original X + X count gate still applies.

Backend Benchmark Metric Change
Distributed array/dagger/N=1024 (block 128)/add (X + X) memory +38.0%
Threads (1 process × 4 threads) — 0 regressions, 1 improvements
Suite Regressions Improvements Within noise Inconclusive metrics
array 0 0 4 1
linalg 0 1 0 0
sparse 0 0 0 0
stencil 0 0 0 0

Improvements

Benchmark Metric Change
linalg/dagger/N=1024 (block 128)/svd allocs -31.1%

Within noise

Benchmark Metric Change
array/dagger/N=1024 (block 512)/add (X + X) time +61.8%
array/dagger/N=256 (block 256)/norm time +42.8%
array/dagger/N=1024 (block 512)/broadcast (X .+ 1) time +42.6%
array/dagger/N=1024 (block 512)/transpose (permutedims) time +33.6%

Inconclusive metric changes

Benchmark Metric Change
array/dagger/N=256 (block 256)/broadcast (X .+ 1) time +31.8%
Distributed (4 processes × 1 thread) — 2 regressions, 0 improvements
Suite Regressions Improvements Within noise Inconclusive metrics
array 0 0 1 0
linalg 0 0 0 1
sparse 2 0 0 0
stencil 0 0 0 2

Regressions

Benchmark Metric Change
sparse/dagger/N=1024 (block 64)/spgemm (S*S) allocs +35.2%
sparse/dagger/N=1024 (block 64)/spgemm (S*S) memory +29.1%

Within noise

Benchmark Metric Change
array/dagger/N=256 (block 256)/broadcast (X .+ 1) time +36.0%

Inconclusive metric changes

Benchmark Metric Change
stencil/dagger/N=256 (block 128)/alloc (neighbors Wrap) time +46.7%
stencil/dagger/N=256 (block 128)/neighbors (Clamp) time +44.7%
linalg/dagger/N=256 (block 128)/matvec (A*x) time +43.4%
Distributed+Threads (2 processes × 2 threads) — 0 regressions, 0 improvements
Suite Regressions Improvements Within noise Inconclusive metrics
array 0 0 0 0
linalg 0 0 0 1
sparse 0 0 0 0
stencil 0 0 0 2

Inconclusive metric changes

Benchmark Metric Change
stencil/dagger/N=1024 (block 512)/neighbors (Wrap) time +68.8%
stencil/dagger/N=1024 (block 512)/neighbors (Pad) time +64.7%
linalg/dagger/N=256 (block 128)/solve (A\b via lu) time +38.1%
MPI (4 ranks × 1 thread) — 0 regressions, 1 improvements
Suite Regressions Improvements Within noise Inconclusive metrics
array 0 1 0 0
linalg 0 0 1 1
sparse 0 0 0 0
stencil 0 0 0 1

Improvements

Benchmark Metric Change
array/dagger/N=1024 (block 128)/transpose (permutedims) time -43.4%

Within noise

Benchmark Metric Change
linalg/dagger/N=256 (block 128)/solve (A\b via lu) time -42.4%

Inconclusive metric changes

Benchmark Metric Change
stencil/dagger/N=1024 (block 128)/neighbors (Clamp) time +38.1%
linalg/dagger/N=1024 (block 128)/qr time +37.0%
MPI+Threads (2 ranks × 2 threads) — 1 regressions, 1 improvements
Suite Regressions Improvements Within noise Inconclusive metrics
array 0 0 4 0
linalg 1 0 2 1
sparse 0 0 0 0
stencil 0 1 0 1

Regressions

Benchmark Metric Change
linalg/dagger/N=256 (block 256)/matvec (A*x) time +36.6%

Improvements

Benchmark Metric Change
stencil/dagger/N=256 (block 256)/neighbors (Clamp) time -43.2%

Within noise

Benchmark Metric Change
linalg/dagger/N=256 (block 128)/matmul (A*A) time +92.7%
linalg/dagger/N=256 (block 128)/solve (A\b via lu) time +43.4%
array/dagger/N=1024 (block 128)/norm time +37.2%
array/dagger/N=256 (block 128)/transpose (permutedims) time -39.5%
array/dagger/N=256 (block 128)/add (X + X) time -42.7%
array/dagger/N=256 (block 128)/map (sin.(X)) time -57.1%

Inconclusive metric changes

Benchmark Metric Change
stencil/dagger/N=1024 (block 512)/alloc (neighbors Wrap) time +53.0%
linalg/dagger/N=256 (block 256)/solve (A\b via lu) time +42.2%

Full results and plots (download the benchmark-results-* artifacts).

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant