Repository navigation
xpu: shared TP events use device scope, as their comment says - #3980
Conversation
644da4d to
94b7fe6
Compare
|
Thanks @SergiioB. The two lines read right: scope 2 is what the Level Zero header promises for peer-device access, and that is what the cross-rank waits need; the comment now matches the code, and your bench and collective runs cover it. One thing is open: we have not seen the checks on this head yet. Please let them run and post the result. The only file that needs a touch at merge time is the changelog hunk, the usual Unreleased rebase. We were unable to run any XPU cell on our side, so your posted runs stand as the device evidence.
|
|
I trial-merged zig build test-flashnext-xpu-host test-draft-xpu-host test-xpu-refusal-host \
compile-xpu-qwen27-tail-linux -Dcpu=apple_m1 -j5 --summary allI also ran Igor Lessio - AIFLOW LABS |
sharedEvents created its events with signal = wait = 1, which is ZE_EVENT_SCOPE_FLAG_SUBDEVICE, while the comment says DEVICE. Every rank waits on events another card signals, and only DEVICE scope (2) promises cache flushes "sufficient for global device access and peer device access".
94b7fe6 to
4ff2363
Compare
|
Thank you @SergiioB. This is merged into main with your commits under your own name, so you're listed as a TensorFold contributor. It ships in the next release, credited to you in the changelog and the release notes. |
What this changes
Gpu.sharedEvents(zig/src/xpu/ze.zig:365-366, from #3585) creates the cross-card TP events with.signal = 1, .wait = 1, and its comment calls that DEVICE. In Level Zero1isZE_EVENT_SCOPE_FLAG_SUBDEVICE;DEVICEis2. The header gives SUBDEVICE cache flushes "sufficient for local sub-device access" and DEVICE"sufficient for global device access and peer device access". Every rank waits on events the other ranks signal
(
tp.zig:130signals,tp.zig:147waits on all ranks), so2is the scope the comment describes. This sets.signal = 2, .wait = 2and corrects the comment: 2 lines. No output was ever seen wrong; this is about what thescope promises, not a failure we reproduced.
change, and the collective table below shows no cost outside the run-to-run spread.
905ce9b11. The receipt below ran on main517a44563against this change as commit1614c927a.zig/src/xpuis identical between517a44563and905ce9b11, and the two lines this head changes differ from1614c927aonly in the comment's wording.atc overlap --json(ATC 0.9.6, 2026-11-19 14:20 UTC, run before the last rebase on base6e7f3083b, head369c64469, the sameze.zigchange):"complete": false,limitations
otherPullRequestsLimit,pullFilesUnavailable,pullRequestsLimit,timeLimit;"changedFiles": 1;13 overlaps, all
"source": 2595(the author's other open pull request, not this branch): 10clean, 3unknown;13
worktreeOverlaps, all"conflict": "conflicts"with 1 file each, all local checkouts on our machine and nonea pull request; each conflicts on
zig/src/xpu/ze.zigonly, the single file this pull request changes, so no pullrequest's work is blocked by them.
atc overlap --pulls 2595,3340,3586,3587,3603,3703,3706,3960,3961 --json(14:23 UTC, every open pull request thatchanges
zig/src/xpuplus three others):"complete": true, all nine inspected,"repositoryComplete": false;3 overlaps, each
"conflict": "conflicts"with 1 file: xpu(qwen27): serve Qwen3.8-27B across TP={1, 2, 4} with DFlash2 #3586, xpu(flashnext): serve Qwen3.8 Flash Next (qwen4_exp) at TP={1, 2, 4} with host-RAM PLE and MTP #3587 and xpu(flashnext): Xe2 DPAS tile kernels, adaptive solo chunks, and confidence MTP #3603, inzig/src/xpu/ze.zig.sharedEventslines from a base before xpu: add Level Zero multi-GPU P2P AllReduce collectives and tf-xpu-tp-bench #3585merged (merge base
6db2561b1), so a merge sees two edits of the same added lines. Their net change against mainleaves those lines alone:
git merge-tree --write-tree --merge-base=origin/mainof this head with each of thethree is clean. If this lands first, the other three keep these two lines when they rebase; if one of them lands first,
this branch applies the same two lines on top, because their net change against main leaves those lines alone. Plain
git merge-treewith theother three open XPU pull requests: xpu: a sampled Qwen3.8-27B row draws from a top-k kept on the card (lands #2895) #3340 clean; XPU: Qwen3.8-27B attention merge with 16 subgroups per head, bit-identical (lands #2799) #3960 and train 1119130356: #3960 (CI only) #3961 conflict only in files they already conflict on
with main (
zig/build/xpu_contract.zig, the XPU contract records and tests, andCHANGELOG.mdfor train 1119130356: #3960 (CI only) #3961), not inze.zig.Checks on this head
94b7fe63a(the change ise56669f14;94b7fe63aadds the CHANGELOG bullet)python3 tools/zig/lean_check.py(this head's checker on both trees, thentools/zig/lean_new.py):189 on
6e7f3083b, 189 on369c64469, 0 new (inherited), run before the last rebase. On this head,python3 tools/pr_check.py --base 905ce9b11 --pr 3980: lean 189 vs 189, 0 new, 0 errors, 0 warnings.zig build xpu-tp-benchthen./zig-out/bin/tf-xpu-tp-bench(no arguments; the binary runs TP=2 then TP=4),from main
517a44563and from this change as1614c927a, 3 runs each in the order main, change, change, main,main, change: 6 passed, 0 failed, 6 skipped (
skipped TP=4: NoDevice), 0 mismatches. The bit-exactness checkcovers 1-shot 32 KB and 2-shot 10 MB against the rank-ordered FP32 reference.
git diff --check 905ce9b11..HEADpasses on this head;zig fmt --check build.zig zigpassed on369c64469,which has the same
ze.zig.skipped TP=4: NoDevice); the served engine, because onmain only
tf-xpu-tp-benchreachesTpComm(xpu(qwen27): serve Qwen3.8-27B across TP={1, 2, 4} with DFlash2 #3586 and xpu(flashnext): serve Qwen3.8 Flash Next (qwen4_exp) at TP={1, 2, 4} with host-RAM PLE and MTP #3587 add the serving callers); no bench run onthis head, whose two changed lines differ from
1614c927aonly in the comment's wording.Receipt
tf-xpu-tp-bench, two Intel Arc Pro B70 (BMG-G31, 32 GB), PCIe 4.0 x8 each from a Ryzen 75700X3D on an X570 board, both capped at 230 W / 2,800 MHz, card temperatures 47-63 °C at the start of each run,
compute-runtime 26.05.37020.3, Zig 0.17.0, ocloc 26.05.1. Best of each run, µs per all-reduce:
517a44563, 3 runs1614c927a, 3 runsThe two columns overlap at every size. A standalone Level Zero chain (each rank's kernel waits on the other
rank's event and then reads the peer's buffer; 25 timed repeats after one discarded, 0 errors) shows no consistent
scope cost at the medians. In the replay cells, scope
1and scope4(HOST) differ by at most 0.02 µs per step at10,240, 40,960 and 163,840 bytes (6.71/6.71, 9.68/9.70, 21.53/21.53 µs). The immediate cells agree within
0.04 µs at 40,960 and 163,840 bytes (11.11/11.09, 22.67/22.63); one 10,240-byte immediate cell reads 11.43 vs
13.06 µs at the medians, with minima of 11.18 vs 11.11 µs. We did not time
ZE_EVENT_SCOPE_FLAG_DEVICEon itsown in that chain, and we have not run the engine with the scope changed; the table above times the change in
the collective only.
TpComm.init→sharedEvents,tp.zig:69). TP=1 returns beforethe call (
tp.zig:39), so one-card runs never create these events. The host never synchronizes them: ithost-synchronizes the lists and then resets them (
tp.zig:101), so HOST scope is not required.905ce9b11(receipt on517a44563), head94b7fe63a(receipt on1614c927a), Zig0.17.0, compute-runtime26.05.37020.3, IGC2.28.4, Level Zero loader1.28.2, ocloc26.05.1, Ubuntu 26.04 (kernel7.0.0-28),Ryzen 7 5700X3D (X570 board), 60 GiB RAM, 2× Intel Arc Pro B70 (BMG-G31, 32 GB, PCIe 4.0 x8), both capped at
230 W / 2,800 MHz. Checkpoint: n/a (the bench loads no model). One local build change on both sides, not in this
pull request:
-cl-intel-128-GRF-per-threaddropped from the Gemma 4 prompt-rows kernel options inzig/build/xpu.zig, which our ocloc 26.05.1 rejects.sharedEvents, called once byTpComm.init. Ran: TP 2 on two B70. Not run: TP 4, other IntelGPUs.
above; no run on your machines is requested.
Checklist
constant is not observable in output, and
tf-xpu-tp-bench's bit-exactness check passes on both sides.lines.
How to revert: revert the merge (or the squashed commit); the code change is
git revert e56669f14.