From 4d29508122918daadd4250ddbdec5d9bb4aec60f Mon Sep 17 00:00:00 2001 From: Julian P Samaroo Date: Thu, 3 Dec 2026 08:55:59 -0700 Subject: [PATCH] Use a supported scheduler in cross-GPU copy fixtures Mainline has no GreedyScheduler, so evaluating the two-device CUDA/ROCm fixture tuple raises UndefVarError before any peer-copy assertion runs. Keep the existing RoundRobin policy and every copy check, without an optional-name guard or an unrelated scheduler substitution. Share the fresh-instance factory with a tiny CPU-registered test so ordinary CI detects invalid fixture construction without two GPUs. Validation: Slurm job1000008 on eos, 2 CPUs/4GiB, completed0:0 with5/5 source-bound before/after constructor assertions on Julia1.13.4. The inner credential-free sandbox had read-only source/dependencies and no network. Both actual baseline tuples raise UndefVarError; the committed factory has the supported type and fresh scheduler state. No copy/kernel/two-GPU native execution or performance result is claimed. git diff --check passes. Written by an AI agent on jpsamaroo's review feedback. --- AGENTS.md | 9 +++++++++ test/gpu.jl | 6 ++++-- test/gpu_peer_schedulers.jl | 11 +++++++++++ test/runtests.jl | 1 + 4 files changed, 25 insertions(+), 2 deletions(-) create mode 100644 test/gpu_peer_schedulers.jl diff --git a/AGENTS.md b/AGENTS.md index 3977148ca..b07fcf8d3 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -1380,3 +1380,12 @@ this section verbatim). Each entry is one bullet starting with `- `. retaining `memory_spans` as the extension fallback. Preserve its exact emptiness semantics: a zero-length contiguous span is still one span, but a strided view with an empty outer dimension has none. + +125. **Validate hardware-gated fixture construction on ordinary CPU CI.** + The two-GPU peer-copy tests named a `GreedyScheduler` that mainline Dagger + never defined. Single-GPU jobs skipped the entire loop and hid the invalid + constructor until a two-device worker failed before checking any copies. + Share the valid constructor factory with a registered CPU test, retaining + fresh mutable scheduler state. Do not substitute another policy without + tracing its current call contract, hide an API typo with an optional guard, + or treat constructor checks as native peer-copy proof. diff --git a/test/gpu.jl b/test/gpu.jl index 18e470085..87e92222a 100644 --- a/test/gpu.jl +++ b/test/gpu.jl @@ -9,6 +9,8 @@ using Krylov using KernelAbstractions end +include("gpu_peer_schedulers.jl") + # Sparse test bodies are shared with the CPU and MPI suites; see the file # header for the acceleration/backend matrix they cover. include(joinpath(@__DIR__, "array", "sparse_defs.jl")) @@ -300,7 +302,7 @@ end # and prior users of the allocations involved. Each case below would # read stale or overwritten data if one of those orderings were lost. ndevices > 1 && @testset "Cross-GPU copies, one process ($(nameof(typeof(sched))))" for sched in - (Dagger.RoundRobinScheduler(), Dagger.GreedyScheduler()) + gpu_peer_copy_schedulers() g1 = Dagger.scope(worker=1, cuda_gpu=1) g2 = Dagger.scope(worker=1, cuda_gpu=2) local_scope = Dagger.scope(worker=1, cuda_gpus=[1, 2]) @@ -546,7 +548,7 @@ end # Two GPUs of one process: see the CUDA testset of the same name ndevices > 1 && @testset "Cross-GPU copies, one process ($(nameof(typeof(sched))))" for sched in - (Dagger.RoundRobinScheduler(), Dagger.GreedyScheduler()) + gpu_peer_copy_schedulers() g1 = Dagger.scope(worker=1, rocm_gpu=1) g2 = Dagger.scope(worker=1, rocm_gpu=2) local_scope = Dagger.scope(worker=1, rocm_gpus=[1, 2]) diff --git a/test/gpu_peer_schedulers.jl b/test/gpu_peer_schedulers.jl new file mode 100644 index 000000000..a446afc73 --- /dev/null +++ b/test/gpu_peer_schedulers.jl @@ -0,0 +1,11 @@ +using Dagger, Test + +# Build fresh instances of the supported policy for each vendor's test region. +# Mainline does not define the GreedyScheduler previously named here. +gpu_peer_copy_schedulers() = (Dagger.RoundRobinScheduler(),) + +@testset "GPU peer-copy scheduler fixtures" begin + schedulers = gpu_peer_copy_schedulers() + @test schedulers isa Tuple{Dagger.RoundRobinScheduler} + @test first(schedulers) !== first(gpu_peer_copy_schedulers()) +end diff --git a/test/runtests.jl b/test/runtests.jl index b00ee914a..26c2a6a25 100644 --- a/test/runtests.jl +++ b/test/runtests.jl @@ -33,6 +33,7 @@ tests = [ ("Task Affinity", "task-affinity.jl"), ("Thread Pinning", "threadpinning.jl"), ("Datadeps", "datadeps.jl"), + ("GPU Peer-copy Fixtures", "gpu_peer_schedulers.jl"), ("Streaming", "streaming.jl"), ("Domain Utilities", "domain.jl"), ("Array - Allocation", "array/allocation.jl"),