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) Interleave workers and their fibers by device. #587

Merged
merged 9 commits into from
Jan 7, 2025
6 changes: 4 additions & 2 deletions shortfin/python/shortfin_apps/sd/components/service.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ def __init__(
self.workers = []
self.fibers = []
self.idle_fibers = set()
for idx, device in enumerate(self.sysman.ls.devices):
for i in range(self.workers_per_device):
# 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):
worker = sysman.ls.create_worker(f"{name}-inference-{device.name}-{i}")
self.workers.append(worker)
for idx, device in enumerate(self.sysman.ls.devices):
Expand Down
Loading