mirror of
https://github.com/mw00/project-maya.git
synced 2026-12-03 21:08:26 +07:00
[GH-ISSUE #616] ds4: a CUDA error in the sampler reaches the client as token -1 (no error checks in sample() / sample_row() / sample_multi()), and logits() copies on the legacy stream #257
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#257
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?
Originally created by @SeriousRising on GitHub (Oct 28, 2026).
Original GitHub issue: https://github.com/mw00/project-maya/issues/616
Symptom
Found by reading; we have not hit a sampler CUDA error. If the head's device faults at the sample, the engine prints
T -1, the server yields token id -1 to the client (serve/server.py:1008yield int(line[2:])), and only the nextforwardfails, with "token -1 out of range". The error is reported a step late and in the wrong place.Cause
src/ds4/ds4_model.cu(v1.1.35): the three samplers end withwith neither return code checked:
sample_row:14066-14069(verify's bonus token,:14138),sample:17580-17583,sample_multi(:17692, copy at:17709). The callers insrc/ds4/ds4_main.cppdo not test for -1:round()'s plain step:338, the first token of a request:1317(serve) and:1544(--parallel),--parallel's steps:1669and:1689, the CLI:2118. The serve loop printsT %dat:1337andT %lld %dat:1599unconditionally.Separately,
logits()(:17722) copies with a blockingcudaMemcpyon the legacy stream, butd.stis createdcudaStreamNonBlocking(:2918), so that copy is not ordered after the head's kernels ond.st. It is safe today only because every path that reacheslogits()has synchronisedd.stfirst.Proposed fix
tok_back(d): the copy + sync with their return codes checked; on an error it printsds4 sample: <CUDA error>and returns -1. All three samplers use it.T %d) and--parallel(T <rid> %d) printds4: the sample failedand finish the request withcancel; the CLI exits 1.logits():cudaMemcpyAsyncond.st+cudaStreamSynchronize, both checked.Error paths and copy ordering only: no numeric change. A PR follows. Not platform-specific.