Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Free engine resource for the slot after finished one request decoding #119

Merged
merged 3 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions jetstream/core/orchestrator.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ def _detokenize_thread(self, idx: int):
# Place the slot back on the free queue.
my_live_requests[slot] = None
my_slots.put(slot, block=False) # This should always have space.
my_generate_engine.free_resource(slot)
logging.info(
"Detokenizing generate step %d took %.2fms",
generate_timestep_added,
Expand Down
12 changes: 12 additions & 0 deletions jetstream/engine/engine_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,18 @@ def insert(
a [0, n) range of slots and converted internally.
"""

def free_resource(
self,
slot: int, # pylint: disable=unused-argument
) -> Any:
"""Free cache and other decode resource for the slot.

This function is needed for advanced attetnion kenel like PageAttetion.
After finishing one request, the engine need to free all used page block
resource and reuse for coming requests.
"""
return None

@abc.abstractmethod
def load_params(self, *args, **kwargs) -> Params:
"""Loads parameters.
Expand Down
Loading