Skip to content

Commit

Permalink
(shortfin-sd) Interleave workers and their fibers by device. (#587)
Browse files Browse the repository at this point in the history
This enables proper "filling" of multi-device topologies that populate
each device evenly, rather than block allocating work to one device at a
time.

Co-authored-by: Ean Garvey <[email protected]>
  • Loading branch information
monorimet and eagarvey-amd authored Jan 7, 2025
1 parent 0e0b42a commit c71a250
Showing 1 changed file with 4 additions and 2 deletions.
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

0 comments on commit c71a250

Please sign in to comment.