Repository navigation
datadeps: track values held in non-concretely-typed fields - #794
Merged
Merged
Conversation
Contributor
Dagger benchmarks:
|
| Backend | Regressions | Improvements | Within noise | Inconclusive time | Suites |
|---|---|---|---|---|---|
| Threads | 0 | 0 | 21 | 1 | 4/4 |
| Distributed | 1 | 2 | 0 | 1 | 4/4 |
| Distributed+Threads | 0 | 1 | 2 | 0 | 4/4 |
| MPI | 0 | 1 | 4 | 1 | 4/4 |
| MPI+Threads | 0 | 0 | 22 | 4 | 4/4 |
| Total | 1 | 4 | 49 | 7 | 20/20 |
Regressions across all backends
| Backend | Benchmark | Metric | Change |
|---|---|---|---|
| Distributed | array/dagger/N=1024 (block 128)/add (X + X) |
memory | +28.8% |
Improvements across all backends
| Backend | Benchmark | Metric | Change |
|---|---|---|---|
| MPI | stencil/dagger/N=1024 (block 128)/neighbors (Clamp) |
time | -38.6% |
| Distributed+Threads | array/dagger/N=1024 (block 512)/norm |
time | -36.0% |
| Distributed | sparse/dagger/N=1024 (block 64)/cg solve (laplacian) |
memory | -30.9% |
| Distributed | sparse/dagger/N=1024 (block 64)/cg solve (laplacian) |
allocs | -27.4% |
Threads (1 process × 4 threads) — 0 regressions, 0 improvements
| Suite | Regressions | Improvements | Within noise | Inconclusive time |
|---|---|---|---|---|
| array | 0 | 0 | 13 | 0 |
| linalg | 0 | 0 | 5 | 0 |
| sparse | 0 | 0 | 0 | 0 |
| stencil | 0 | 0 | 3 | 1 |
Within noise
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=256 (block 256)/alloc (neighbors Wrap) |
time | +220.9% |
array/dagger/N=256 (block 256)/add (X + X) |
time | +62.4% |
array/dagger/N=256 (block 128)/transpose (permutedims) |
time | +55.7% |
linalg/dagger/N=1024 (block 512)/matvec (A*x) |
time | +44.1% |
array/dagger/N=1024 (block 512)/norm |
time | +41.9% |
array/dagger/N=1024 (block 512)/map (sin.(X)) |
time | +38.7% |
array/dagger/N=1024 (block 128)/norm |
time | +36.4% |
linalg/dagger/N=256 (block 128)/matmul (A*A) |
time | +31.1% |
array/dagger/N=256 (block 128)/map (sin.(X)) |
time | +30.0% |
array/dagger/N=256 (block 128)/norm |
time | -25.3% |
stencil/dagger/N=256 (block 256)/multi-expr |
time | -25.5% |
array/dagger/N=1024 (block 512)/broadcast (X .+ 1) |
time | -26.8% |
array/dagger/N=1024 (block 128)/alloc (rand) |
time | -26.8% |
array/dagger/N=256 (block 128)/reduce (sum) |
time | -27.8% |
linalg/dagger/N=256 (block 128)/syrk (A'*A) |
time | -28.0% |
linalg/dagger/N=256 (block 128)/cholesky |
time | -28.9% |
array/dagger/N=1024 (block 128)/broadcast (X .+ 1) |
time | -29.8% |
array/dagger/N=1024 (block 512)/add (X + X) |
time | -30.1% |
stencil/dagger/N=1024 (block 512)/multi-expr |
time | -34.9% |
linalg/dagger/N=256 (block 256)/matvec (A*x) |
time | -35.1% |
array/dagger/N=1024 (block 512)/reduce (sum) |
time | -57.7% |
Inconclusive timing changes
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=256 (block 128)/alloc (neighbors Wrap) |
time | +115.0% |
Distributed (4 processes × 1 thread) — 1 regressions, 2 improvements
| Suite | Regressions | Improvements | Within noise | Inconclusive time |
|---|---|---|---|---|
| array | 1 | 0 | 0 | 0 |
| linalg | 0 | 0 | 0 | 0 |
| sparse | 0 | 2 | 0 | 0 |
| stencil | 0 | 0 | 0 | 1 |
Regressions
| Benchmark | Metric | Change |
|---|---|---|
array/dagger/N=1024 (block 128)/add (X + X) |
memory | +28.8% |
Improvements
| Benchmark | Metric | Change |
|---|---|---|
sparse/dagger/N=1024 (block 64)/cg solve (laplacian) |
memory | -30.9% |
sparse/dagger/N=1024 (block 64)/cg solve (laplacian) |
allocs | -27.4% |
Inconclusive timing changes
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=256 (block 128)/neighbors (Pad) |
time | +37.1% |
Distributed+Threads (2 processes × 2 threads) — 0 regressions, 1 improvements
| Suite | Regressions | Improvements | Within noise | Inconclusive time |
|---|---|---|---|---|
| array | 0 | 1 | 0 | 0 |
| linalg | 0 | 0 | 0 | 0 |
| sparse | 0 | 0 | 0 | 0 |
| stencil | 0 | 0 | 2 | 0 |
Improvements
| Benchmark | Metric | Change |
|---|---|---|
array/dagger/N=1024 (block 512)/norm |
time | -36.0% |
Within noise
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=1024 (block 128)/update (+) |
time | +36.5% |
stencil/dagger/N=1024 (block 128)/assign (const) |
time | -37.3% |
MPI (4 ranks × 1 thread) — 0 regressions, 1 improvements
| Suite | Regressions | Improvements | Within noise | Inconclusive time |
|---|---|---|---|---|
| array | 0 | 0 | 3 | 0 |
| linalg | 0 | 0 | 0 | 0 |
| sparse | 0 | 0 | 0 | 0 |
| stencil | 0 | 1 | 1 | 1 |
Improvements
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=1024 (block 128)/neighbors (Clamp) |
time | -38.6% |
Within noise
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=256 (block 128)/neighbors (Reflect) |
time | +156.5% |
array/dagger/N=1024 (block 512)/transpose (permutedims) |
time | +95.1% |
array/dagger/N=1024 (block 512)/map (sin.(X)) |
time | -57.3% |
array/dagger/N=1024 (block 512)/add (X + X) |
time | -59.1% |
Inconclusive timing changes
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=1024 (block 128)/alloc (neighbors Wrap) |
time | +49.0% |
MPI+Threads (2 ranks × 2 threads) — 0 regressions, 0 improvements
| Suite | Regressions | Improvements | Within noise | Inconclusive time |
|---|---|---|---|---|
| array | 0 | 0 | 13 | 2 |
| linalg | 0 | 0 | 3 | 0 |
| sparse | 0 | 0 | 0 | 0 |
| stencil | 0 | 0 | 6 | 2 |
Within noise
| Benchmark | Metric | Change |
|---|---|---|
array/dagger/N=256 (block 256)/add (X + X) |
time | +148.4% |
array/dagger/N=256 (block 128)/reduce (sum) |
time | +129.5% |
stencil/dagger/N=1024 (block 512)/assign (const) |
time | +125.6% |
array/dagger/N=1024 (block 512)/reduce (sum) |
time | +68.9% |
linalg/dagger/N=256 (block 256)/matmul (A*A) |
time | +63.4% |
array/dagger/N=1024 (block 512)/add (X + X) |
time | +59.4% |
array/dagger/N=1024 (block 512)/map (sin.(X)) |
time | +53.2% |
array/dagger/N=256 (block 128)/add (X + X) |
time | +40.4% |
array/dagger/N=256 (block 256)/reduce (sum) |
time | +39.4% |
stencil/dagger/N=256 (block 128)/neighbors (Pad) |
time | +37.1% |
array/dagger/N=256 (block 128)/norm |
time | -35.0% |
linalg/dagger/N=256 (block 256)/syrk (A'*A) |
time | -35.8% |
stencil/dagger/N=1024 (block 128)/neighbors (Wrap) |
time | -36.8% |
stencil/dagger/N=1024 (block 512)/update (+) |
time | -37.6% |
array/dagger/N=256 (block 128)/transpose (permutedims) |
time | -37.7% |
stencil/dagger/N=256 (block 128)/neighbors (Wrap) |
time | -38.1% |
linalg/dagger/N=256 (block 128)/lu |
time | -43.8% |
array/dagger/N=1024 (block 512)/norm |
time | -43.9% |
array/dagger/N=256 (block 128)/alloc (rand) |
time | -54.6% |
array/dagger/N=256 (block 128)/map (sin.(X)) |
time | -63.1% |
stencil/dagger/N=256 (block 128)/update (+) |
time | -73.4% |
array/dagger/N=256 (block 128)/broadcast (X .+ 1) |
time | -74.9% |
Inconclusive timing changes
| Benchmark | Metric | Change |
|---|---|---|
stencil/dagger/N=1024 (block 512)/multi-expr |
time | +259.2% |
stencil/dagger/N=256 (block 128)/multi-expr |
time | +246.7% |
array/dagger/N=256 (block 256)/transpose (permutedims) |
time | +244.1% |
array/dagger/N=1024 (block 128)/alloc (rand) |
time | +67.2% |
Full results and plots (download the benchmark-results-* artifacts).
fda-tome
added a commit
to AnnaLena77/Dagger_AL.jl
that referenced
this pull request
Nov 26, 2026
MPIExt's cross-rank remainder copy fenced with the `atomic_fence`
intrinsic called with one argument. Julia 1.14 added a sync-scope
argument to that intrinsic, so on 1.14.0-beta1 (CI's `pre`) the copy
fails to compile ("intrinsic_call: too few arguments (expected 2)"):
every MPI Datadeps test that copies part of an argument across ranks
errors on the receiving rank, and the ranks then fall out of step
("Non-uniform value"). Use `Threads.atomic_fence()`, which Base keeps
in step with the intrinsic, as src/datadeps/remainders.jl already does
(aafc1ec). It is sequentially consistent, a superset of the release
ordering it replaces.
The custom-commands workflow installed Julia 1.9, whose binaries no
longer start on the current ubuntu-latest image (glibc refuses the
executable stack libopenlibm.so requests), so its setup step failed on
every pull request. Install the current release instead.
CPU MPI suite on Julia 1.14.0-beta1, 2 threads per rank: before, 945
passed, 3 failed and 51 errored at 2 ranks; after, every assertion
passes at 2 and 4 ranks, on master and on JuliaParallel#790-JuliaParallel#794 with this change.
fda-tome
added a commit
to AnnaLena77/Dagger_AL.jl
that referenced
this pull request
Nov 26, 2026
MPIExt's cross-rank remainder copy fenced with the `atomic_fence`
intrinsic called with one argument. Julia 1.14 added a sync-scope
argument to that intrinsic, so on 1.14.0-beta1 (CI's `pre`) the copy
fails to compile ("intrinsic_call: too few arguments (expected 2)"):
every MPI Datadeps test that copies part of an argument across ranks
errors on the receiving rank, and the ranks then fall out of step
("Non-uniform value"). Use `Threads.atomic_fence()`, which Base keeps
in step with the intrinsic, as src/datadeps/remainders.jl already does
(aafc1ec). It is sequentially consistent, a superset of the release
ordering it replaces.
The custom-commands workflow installed Julia 1.9, whose binaries no
longer start on the current ubuntu-latest image (glibc refuses the
executable stack libopenlibm.so requests), so its setup step failed on
every pull request. Install the current release instead.
CPU MPI suite on Julia 1.14.0-beta1, 2 threads per rank: before, 945
passed, 3 failed and 51 errored at 2 ranks; after, every assertion
passes at 2 and 4 ranks, on master and on JuliaParallel#790-JuliaParallel#794 with this change.
fda-tome
added a commit
to AnnaLena77/Dagger_AL.jl
that referenced
this pull request
Nov 26, 2026
MPIExt's cross-rank remainder copy fenced with the `atomic_fence`
intrinsic called with one argument. Julia 1.14 added a sync-scope
argument to that intrinsic, so on 1.14.0-beta1 (CI's `pre`) the copy
fails to compile ("intrinsic_call: too few arguments (expected 2)"):
every MPI Datadeps test that copies part of an argument across ranks
errors on the receiving rank, and the ranks then fall out of step
("Non-uniform value"). Use `Threads.atomic_fence()`, which Base keeps
in step with the intrinsic, as src/datadeps/remainders.jl already does
(aafc1ec). It is sequentially consistent, a superset of the release
ordering it replaces.
The custom-commands workflow installed Julia 1.9, whose binaries no
longer start on the current ubuntu-latest image (glibc refuses the
executable stack libopenlibm.so requests), so its setup step failed on
every pull request. Install the current release instead.
CPU MPI suite on Julia 1.14.0-beta1, 2 threads per rank: before, 945
passed, 3 failed and 51 errored at 2 ranks; after, every assertion
passes at 2 and 4 ranks, on master and on JuliaParallel#790-JuliaParallel#794 with this change.
fda-tome
added a commit
to AnnaLena77/Dagger_AL.jl
that referenced
this pull request
Nov 26, 2026
MPIExt's cross-rank remainder copy fenced with the `atomic_fence`
intrinsic called with one argument. Julia 1.14 added a sync-scope
argument to that intrinsic, so on 1.14.0-beta1 (CI's `pre`) the copy
fails to compile ("intrinsic_call: too few arguments (expected 2)"):
every MPI Datadeps test that copies part of an argument across ranks
errors on the receiving rank, and the ranks then fall out of step
("Non-uniform value"). Use `Threads.atomic_fence()`, which Base keeps
in step with the intrinsic, as src/datadeps/remainders.jl already does
(aafc1ec). It is sequentially consistent, a superset of the release
ordering it replaces.
The custom-commands workflow installed Julia 1.9, whose binaries no
longer start on the current ubuntu-latest image (glibc refuses the
executable stack libopenlibm.so requests), so its setup step failed on
every pull request. Install the current release instead.
CPU MPI suite on Julia 1.14.0-beta1, 2 threads per rank: before, 945
passed, 3 failed and 51 errored at 2 ranks; after, every assertion
passes at 2 and 4 ranks, on master and on JuliaParallel#790-JuliaParallel#794 with this change.
fda-tome
added a commit
that referenced
this pull request
Nov 26, 2026
MPIExt's cross-rank remainder copy fenced with the `atomic_fence`
intrinsic called with one argument. Julia 1.14 added a sync-scope
argument to that intrinsic, so on 1.14.0-beta1 (CI's `pre`) the copy
fails to compile ("intrinsic_call: too few arguments (expected 2)"):
every MPI Datadeps test that copies part of an argument across ranks
errors on the receiving rank, and the ranks then fall out of step
("Non-uniform value"). Use `Threads.atomic_fence()`, which Base keeps
in step with the intrinsic, as src/datadeps/remainders.jl already does
(aafc1ec). It is sequentially consistent, a superset of the release
ordering it replaces.
The custom-commands workflow installed Julia 1.9, whose binaries no
longer start on the current ubuntu-latest image (glibc refuses the
executable stack libopenlibm.so requests), so its setup step failed on
every pull request. Install the current release instead.
CPU MPI suite on Julia 1.14.0-beta1, 2 threads per rank: before, 945
passed, 3 failed and 51 errored at 2 ranks; after, every assertion
passes at 2 and 4 ranks, on master and on #790-#794 with this change.
fda-tome
force-pushed
the
jps/type-may-alias-abstract-fields
branch
from
November 26, 2026 18:51
7d70285 to
0eba865
Compare
`type_may_alias` answered `false` for any field whose declared type is not
concrete (abstract, `Union`, or untyped), and Datadeps passes such arguments
through untracked. So `struct Box; v::AbstractVector{Float64}; end` (or
`v::Union{Nothing,Vector{Float64}}`, or plain `v`) got no reader/writer
ordering: an `In(b)` reader ran concurrently with the `InOut(b)` writer and saw
the old data, while the same struct with `v::Vector{Float64}` was ordered
correctly. No error, just wrong results.
A non-concrete field now counts as possibly aliasing, except a Union of plain
data (`Union{Nothing,Int}`), which can never hold mutable memory. Whether a
given value actually does is then decided from the value, but only for types
where the type alone cannot say (`type_alias_depends_on_value`), so arrays and
other concretely typed arguments take exactly the path they did before.
That per-value check (`value_may_alias`) is required, not an optimization:
a tracked value with no memory spans has aliasing without an address, so all
such values compare equal and the aliased-object cache hands one argument's
slot to the next. With only the type change, MPI tasks given `S(1)..S(4)` of
`struct S; part::Int; x; end` received `S(2), S(2), S(4), S(4)`. Values with
no spans are therefore passed through untracked, as before. The hierarchical
pre-scan makes the same decision so both paths agree.
Values whose aliasing cannot be computed now error as they already do for a
concretely typed field (e.g. a `Dict` held in an untyped field), rather than
being silently skipped; declare `type_may_alias(::Type{T}) = false` for types
that are never mutated.
Tests: the Distributed ordering tests fail on master (reader sees 0.0), and the
MPI test fails when the per-value check is disabled; both pass here.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jpsamaroo
force-pushed
the
jps/type-may-alias-abstract-fields
branch
from
November 27, 2026 23:50
0eba865 to
39d058b
Compare
Review integration on PR #794. Retain master's typed task/argument function barriers in the hierarchical pre-scan, applying the existing per-value alias check in _collect_arg_value!. Keep both the non-concrete field regressions and master's history regression. The net PR change remains the same 186 added lines across seven files. Credential-free Datadeps validation is in progress; the initial Julia 1.12 attempt failed in the dependency compiler/linker before tests ran. Written by an AI agent on jpsamaroo's review feedback.
Leaf wrappers sharing spans cannot reuse another header unless they register the existing move_rewrap protocol. Compare ambiguous immutable metadata on its owner and broadcast the MPI decision, preserving registered wrappers and ordinary arrays. Document all required hooks instead of attempting to bypass constructors. Focused Distributed checks pass18; independent2rank MPI controls pass14+10 across both planners including rejection recovery. Allocation bounds remain25/25 unchanged; deep warmed minima retain178 task allocations /6.5KiB and60 empty-region allocations /2.7KiB before and after. Full Datadeps before guard2222pass2broken. Written by an AI agent on jpsamaroo's review feedback.
Julia Type objects are internally mutable but passed by value in Datadeps. Preserve Type, Symbol and custom nonaliasing headers rather than treating them as mutable storage. Focused controls reject different integer, Type and Symbol wrapper headers on both Distributed planners;30assertions pass. Written by an AI agent on jpsamaroo's review feedback.
Use recursive presence checks for core aliasing shapes and retain memory_spans fallback for custom shapes. Empty and zero-sized view/triangular controls match the existing span contract; final metadata suite46assertions passes. After10warmups+GC,min5 runs of1000value_may_alias calls on an Any-field vector wrapper:6000allocations/224000bytes before,3000/112000after. This measures the actual value-dependent path, including aliasing construction, rather than only an emptiness helper. Written by an AI agent on jpsamaroo's review feedback.
Written by an AI agent on jpsamaroo's review feedback.
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.
Problem
type_may_aliasansweredfalsefor any struct field whose declared type is not concrete: an abstract type, aUnion, or an untyped field. Datadeps passes such arguments through untracked, so their readers and writers were never ordered:The same struct with
v::Vector{Float64}is ordered correctly. There is no error, just wrong results. This reproduces with threads in a single process.Fix
type_may_alias: a non-concrete type now counts as possibly aliasing. The exception is a Union of plain-data types (Union{Nothing,Int}), which can never hold mutable memory.type_alias_depends_on_value), Datadeps checks the value itself (value_may_alias). Arrays and other concretely typed arguments take exactly the path they did before. The hierarchical pre-scan makes the same decision, so the two paths agree.The per-value check is needed for correctness, not just speed. A tracked value with no memory spans has aliasing with no address, so all such values compare equal, and the aliased-object cache (keyed by aliasing) hands one argument's slot to the next. With only the
type_may_aliaschange, MPI tasks givenS(1)..S(4)ofstruct S; part::Int; x; endreceivedS(2), S(2), S(4), S(4). So values with no spans are passed through untracked, exactly as before. (This is the same collision #792 reports, reached here through a type whose declarations are consistent.)Behavior change
A value whose aliasing can't be computed now errors, the same way it already does when the field is concretely typed. Example: a
DictorVector{String}held in an untyped field. Before, such values were silently skipped. Types that are never mutated can opt out withDagger.type_may_alias(::Type{T}) = false, asPinnedTileOperatordoes.Tests
test/datadeps.jl, "Non-concrete fields": unit tests for the predicates, plus writer→reader ordering for abstract, Union, and untyped fields. The ordering tests fail on master (the reader sees0.0).test/mpi/nonconcrete_fields.jl: untyped-field values with no memory each reach their own task, both from upstream tasks and as plain values. This test fails with the per-value check disabled ([2,2,4,4]).datadeps(1553 + 2 broken),allocations(24/24),memory-spaces,mutation, iterative solvers, stencils, Cholesky, LU. MPI CPU suite at 2 ranks × 2 threads: 1131/1131 and 1134/1134.The second commit adds an AGENTS.md lesson.
🤖 Generated with Claude Code