diff options
| author | IlyassRS <ilyassroussi2000@gmail.com> | 2026-11-25 13:04:22 +0100 |
|---|---|---|
| committer | IlyassRS <ilyassroussi2000@gmail.com> | 2026-11-25 13:04:22 +0100 |
| commit | 3e6e229a642e3c4c7787291d9d975dff74b535a9 (patch) | |
| tree | 10fc814b81cca7fd98e3c78647a1fe3969a93916 /tests/test_run_gpu_tests_python_assembler.py | |
| parent | 0d80bc5df7c873f40965f34f185cb96913786765 (diff) | |
runtime: make QueueHolds pump handoff race-free, exception-safe, and per-instance
Fix three bugs in runtime/src/queue_holds.h (the cross-queue Wait-before-Signal
and Present barrier scheduler):
1. Lost-wakeup handoff race in pump_ready(): previously a thread exiting
pump_ready() called pump.unlock() (release) followed by dirty_.load(acquire),
while a concurrent caller wrote dirty_.store(true, release) followed by a
failing pump_mutex_.try_lock(). Under the C++ memory model and on weak
architectures (ARM64), a release followed by an acquire does not prevent
Store-Load reordering, allowing both threads to exit with dirty_ == true
and ready batches/presents stuck indefinitely. Serialize dirty_ and
pump_active_ transitions under the leaf mutex_ (preserving strict
pump_mutex_ -> mutex_ lock ordering).
2. Exception-safety deadlock: in_pump() was toggled manually around
discard_waiting_on(), release_ready(), and run_barriers(); any exception
left in_pump() permanently true on that thread, silently suppressing every
future pump_ready() and remove_fence(). Use an RAII PumpScope and
ActiveGuard so state always unwinds cleanly.
3. Cross-instance collision: in_pump() used a single process-wide
thread_local bool shared across all QueueHolds instances, causing a nested
pump_ready()/remove_fence() on a second instance to be skipped. Track
re-entrancy per instance with a stack-allocated intrusive PumpScope chain.
Add portable unit and concurrency stress suite runtime/test/queue_holds_test.cpp.
Item: RT-QUEUE-HOLDS-PUMP-SAFETY
Diffstat (limited to 'tests/test_run_gpu_tests_python_assembler.py')
0 files changed, 0 insertions, 0 deletions