Add ResizableSemaphore for adaptive pipeline concurrency (#1389)#1389
Open
justinvjoseph wants to merge 1 commit into
Open
Add ResizableSemaphore for adaptive pipeline concurrency (#1389)#1389justinvjoseph wants to merge 1 commit into
justinvjoseph wants to merge 1 commit into
Conversation
Contributor
|
@justinvjoseph has exported this pull request. If you are a Meta employee, you can view the originating Diff in D99920401. |
…earch#1389) Summary: Add `ResizableSemaphore` — an asyncio-compatible semaphore whose max permit count can be adjusted at runtime. This is the foundational primitive for dynamic concurrency control in SPDL pipelines. Key features: - `resize(new_max)` adjusts permits at runtime; resize-up wakes blocked waiters immediately, resize-down drains gracefully (no preemption) - `acquire()`/`release()` semantics match `asyncio.Semaphore` - `max_value` and `active` properties for observability - Thread-safe within asyncio's single-threaded model - Comprehensive error handling for invalid values This is Diff 1 of a 5-diff series implementing a unified adaptive scheduler for SPDL pipelines (T262755626). Differential Revision: D99920401
46cf1ca to
0789747
Compare
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.
Summary:
Add
ResizableSemaphore— an asyncio-compatible semaphore whose max permit count can be adjusted at runtime. This is the foundational primitive for dynamic concurrency control in SPDL pipelines.Key features:
resize(new_max)adjusts permits at runtime; resize-up wakes blocked waiters immediately, resize-down drains gracefully (no preemption)acquire()/release()semantics matchasyncio.Semaphoremax_valueandactiveproperties for observabilityThis is Diff 1 of a 5-diff series implementing a unified adaptive scheduler for SPDL pipelines (T262755626).
Differential Revision: D99920401