Skip to content

Commit 106bf74

Browse files
committed
fixup! test(core.utils): rewriter does one final uncontested write to avoid scheduler-race flake
1 parent 463af75 commit 106bf74

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

cuda_core/tests/test_program_cache_multiprocess.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,11 @@ def _worker_race_rewriter(root: str, key: bytes, start_event, done_event) -> Non
121121
atomically replacing the file while the reader keeps loading a
122122
deliberately-corrupt copy and deciding whether to prune it. The reader
123123
must never delete the writer's valid record.
124+
125+
After ``done_event`` fires (set by the caller only after the reader has
126+
joined), the rewriter lands one final uncontested write so the test's
127+
end-state assertion does not hinge on scheduler-dependent interleaving
128+
of the last write vs. the reader's last prune.
124129
"""
125130
from cuda.core._module import ObjectCode
126131
from cuda.core.utils import FileStreamProgramCache
@@ -131,6 +136,7 @@ def _worker_race_rewriter(root: str, key: bytes, start_event, done_event) -> Non
131136
while not done_event.is_set():
132137
cache[key] = ObjectCode._init(f"good-{i}".encode() * 64, "cubin", name=f"g{i}")
133138
i += 1
139+
cache[key] = ObjectCode._init(b"good-final" * 64, "cubin", name="g-final")
134140

135141

136142
def _worker_race_corrupt_reader(root: str, key: bytes, rounds: int, start_event, result_queue) -> None:

0 commit comments

Comments
 (0)