Repository navigation
Dispatch registrations table is published whole under a lock (#76 B6) - #112
Merged
Merged
Conversation
…er a lock (#76 B6) _scan_dispatch_registrations filled the shared dict in place, and its "already built" check was true as soon as the keys were inserted, before any name was. Eight threads asking at once at a 1 us switch interval got back seven empty lists and one 743-name list. The table is now built into a fresh dict and bound to the global under a lock, so a reader sees no table or the finished one. - test_threadstate: 8 threads behind a Barrier, three fresh subprocesses; red before (seen [0,0,0,0,0,0,0,743]), green after. - 3.15t with PYTHON_GIL=0 (free-threaded _C, .scratch stage): 743 x 8, three runs of three.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #76
The last open item of #76. The capture flag (992c69c) and the Arc-held RNG streams (f506e52) already landed in develop via #70; per-thread grad mode and device stack via #77.
_scan_dispatch_registrations(bootstrap.py) filled the shared_DISPATCH_REGISTRATIONSin place, and its "already built" check fired as soon as the keys existed. It now builds into a local dict and publishes it under_DISPATCH_REGISTRATIONS_LOCK.test_dispatch_registrations_built_by_eight_threads_at_once_are_whole(tests/api/test_threadstate.py), 8 threads behind a Barrier, three fresh subprocesses.seen [0, 0, 0, 0, 0, 0, 0, 743].PYTHON_GIL=0, using a free-threaded_Cbuilt into .scratch: 743 names x 8 threads, 3 of 3 runs,sys._is_gil_enabled()False.What the test cannot see: removing only the lock (keeping the local build) still passes, because the rebinding alone already keeps readers whole. The lock only avoids two threads scanning the file twice.
Local: test_threadstate 8/8, test_shim 480 ok EXIT=0, test_style EXIT=0. Full gate not run; CI on develop push (#109).