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

[Shortfin] SD server indexing fix #892

Merged
merged 3 commits into from
Feb 3, 2025
Merged
Changes from all 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
9 changes: 5 additions & 4 deletions shortfin/python/shortfin_apps/sd/components/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,14 @@ def __init__(
self.idle_fibers = set()
# For each worker index we create one on each device, and add their fibers to the idle set.
# This roughly ensures that the first picked fibers are distributed across available devices.
for i in range(self.workers_per_device):
for idx, device in enumerate(self.sysman.ls.devices):
for idx, device in enumerate(self.sysman.ls.devices):
for i in range(self.workers_per_device):
worker = sysman.ls.create_worker(f"{name}-inference-{device.name}-{i}")
self.workers.append(worker)
for idx, device in enumerate(self.sysman.ls.devices):
for i in range(self.fibers_per_device):
tgt_worker = self.workers[i % len(self.workers)]
tgt_worker = self.workers[
idx * workers_per_device + i % workers_per_device
]
fiber = sysman.ls.create_fiber(tgt_worker, devices=[device])
self.fibers.append(fiber)
self.idle_fibers.add(fiber)
Expand Down
Loading