mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[PR #550] [CLOSED] DeepSeek: close two expert-table publication races #591
Labels
No labels
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
mw00/project-maya#591
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/mw00/project-maya/pull/550
Author: @handmade0octopus
Created: 10/27/2026
Status: ❌ Closed
Base:
main← Head:pr/ds4-stream-table-races📝 Commits (1)
06bd0c4DeepSeek: close two expert-table publication races📊 Changes
2 files changed (+85 additions, -1 deletions)
View changed files
📝
src/ds4/ds4_model.cu(+12 -1)➕
tests/ds4_tab_set_buffer_sentinel.cu(+73 -0)📄 Description
Summary
rc_updpair buffer, so an earliertab_setcannot read overwritten input.1. Swap/landing duplicate publication
land_dst()could select an expert withe == l.sw_in. The recent-slot landing and pending swap then owned the same expert, and their two differentvram_tab[e]updates could enter onetab_setlaunch.tab_set_kernel()assigns pairs to independent threads, so host append order does not determine which value survives.An instrumented live capture showed exactly this for layer 7, expert 73: one submitted batch contained the recent-slot write followed by the swap write, while the host canonical slot was 94 and the device table/recent slot used slot 63:
Excluding
e == l.sw_inmirrors the recent-fill path's existing exclusion. It fixes both the duplicate table publication and duplicate ownership; merely deduplicating writes would not fix ownership. No expert or route is skipped: the guarded pick uses staging and the pending swap completes normally.2. Host-mapped input reuse
tick_flush()reuses one mappedrc_updbuffer per device. A later flush could overwrite those pairs before an earlier queuedtab_setread them, especially across back-to-backcache_drain()/rc_drain()flushes. Live instrumentation separately observed an intended eviction-to-zero that remained nonzero on device.The included
tests/ds4_tab_set_buffer_sentinel.cuuses the exact three-linetab_set_kerneland a delay to force two batches to queue before either reads the shared input. On an RTX 4090 D it produced:Synchronizing before every nonempty overwrite covers ordinary ticks and both drain paths. Ordinary forward ticks already synchronize this stream, so their additional wait is normally a no-op; a drain now waits only for the predecessor work required for correctness.
Validation
The two normal-path guards were tested together on Windows with
DS4_STREAM_WIN=1,DS4_LAND=1, full streaming zero-copy, and DSpark enabled:The instrumented candidate also answered real HTTP generations and ran under exact-token capture with first-fault monitoring. These tests support the fixes but do not prove that a previously observed, un-reproduced CUDA IMA is eliminated; this PR fixes the two independently demonstrated corruption mechanisms above.
PR-base validation: clean Windows CUDA 12.8 / arch 89 Release build of
maya-ds4on upstreammainc4be544(v1.1.31) passed. Built engine SHA-256:F9805305BBFD28E148372277CE9E8E1D4F4676EBDDF414EBCFF6AC6A5D920D83.git diff --checkand independent static review passed with no remaining blockers.Notes
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.