done_mode=spin (experimental): the rescue path's flag write can be lost while the spin polls
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Anfängerfreundlichkeit
- 48/100
Rechercherichtung
Start with the rescue-flag path in clean/runtime/interop/backend.cpp and the existing flag pass; compare its write with WriteBufferImmediate. Read the spin polling path in clean/runtime/interop/convert.cpp to understand how the flag is consumed. Replace the rescue write with a compute dispatch on the rescue queue, then test that a rescued frame avoids a spin timeout and measure the HIP writer case on hardware.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
With the experimental options ready_wait=memory and done_mode=spin, the game's queue runs a one-thread pass that
polls the done flag with an atomic (InterlockedAdd(flag, 0), PASS_SPIN in clean/runtime/interop/convert.cpp)
until the network writes it. When the network of a frame cannot be enqueued, rescue_flag
(clean/runtime/interop/backend.cpp) is meant to release that spin: a separate list on the backend's own compute queue
waits for the previous network frame, then writes the flag with WriteBufferImmediate. The spin was recorded into the
game's list before that, so the write can arrive while the spin is polling.
Measured on Windows with a test harness (no HIP): a flag written by a shader store on another queue while the spin
polls is seen in 5 of 5 runs; the same flag written with WriteBufferImmediate on another queue is not seen in any of
5 runs, the spin times out, and the flag still reads its old value afterwards: the write is lost, not late. Written
after the spin has finished, the same WriteBufferImmediate lands.
Why: while the spin polls, the flag buffer is in a write state on the game's queue (its atomic is a read-modify-write,
UNORDERED_ACCESS), and the rescue list writes the same 32 bits from a second queue (COPY_DEST, by implicit
promotion from COMMON, which is valid for buffers). Buffers have simultaneous-access semantics, which allow "multiple
readers and one writer, as long as the writer doesn't concurrently modify the texels that other readers are accessing"
(D3D12_RESOURCE_FLAGS, D3D12_RESOURCE_FLAG_ALLOW_SIMULTANEOUS_ACCESS). Two queues writing the same 32 bits at once
breaks the first half of that rule. The second half means that no cross-queue write to the flag while the spin reads
it is covered by the API, whoever writes it: the spin design as a whole relies on how the hardware behaves, which is
why it is experimental. On this hardware a shader write is seen and a command-processor write is lost.
The cost today: one spin timeout (bounded by spin_polls) and a stale flag for that frame. The normal writer
(hipStreamWriteValue32 on the HIP stream) also writes while the spin polls; whether it is seen could not be measured
here.
To do: write the rescue flag with the existing flag pass (a compute dispatch on the rescue queue: the shader-write case
that worked) instead of WriteBufferImmediate, and test that a rescued frame no longer costs a timeout. Measure the
HIP writer's case on hardware. Until this is fixed, the option's documentation states that spin mode relies on
behaviour the API does not guarantee.
Related: #7
- Vorherrschende Sprache
- C++
- Sterne
- 12
- Forks
- 2
- Ø Merge
- 3 Std. 10 Min.
- Gemergte PRs (30 T.)
- 171
Entwicklungsumgebung
- Kein Dockerfile und keine Docker-Compose-Datei
- Hat eine Pull-Request-Vorlage
- Beitragsleitfaden lesen
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus phantoslayer21/wronggpu
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
phantoslayer21/wronggpu#275 ·
Maintainer antworten meist innerhalb von 1 Tag
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
phantoslayer21/wronggpu#274 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 88/100
phantoslayer21/wronggpu#241 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug build
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 74/100
phantoslayer21/wronggpu#234 ·
Maintainer antworten meist innerhalb von 1 Tag
-
bug build
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 80/100
phantoslayer21/wronggpu#233 ·
Maintainer antworten meist innerhalb von 1 Tag
Alle Issues in phantoslayer21/wronggpu
Ähnliche Issues
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 77/100
Maintainer antworten meist innerhalb von 1 Tag
-
bug good first issue
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
ReyeMe/SaturnRingLib#155 ·
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 62/100
Nheko-Reborn/nheko#2092 ·
-
Schwierigkeit 1/5 1-3 Stunden Anfängerfreundlichkeit 78/100
isocpp/CppCoreGuidelines#2345 ·
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 71/100
ROCm/rocm-libraries#16108 ·
Maintainer antworten meist innerhalb von 2 Tagen