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

Add ability to include a plugin when creating driver #740

Merged
merged 3 commits into from
Jun 17, 2024
Merged
Show file tree
Hide file tree
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
1 change: 1 addition & 0 deletions .github/workflows/test_models.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ jobs:
pip install --no-compile -r ${{ github.workspace }}/iree-turbine/pytorch-cpu-requirements.txt
pip install --no-compile --pre --upgrade -r ${{ github.workspace }}/iree-turbine/requirements.txt
pip install --no-compile --pre -e ${{ github.workspace }}/iree-turbine[testing]
pip install --upgrade --pre --no-cache-dir iree-compiler iree-runtime -f https://iree.dev/pip-release-links.html
pip install --no-compile --pre --upgrade -e models -r models/requirements.txt

- name: Show current free memory
Expand Down
16 changes: 14 additions & 2 deletions models/turbine_models/model_runner.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,24 @@
import argparse
import sys
from iree import runtime as ireert
from iree.runtime._binding import create_hal_driver


class vmfbRunner:
def __init__(self, device, vmfb_path, external_weight_path=None):
def __init__(self, device, vmfb_path, external_weight_path=None, extra_plugin=None):
flags = []
haldriver = ireert.get_driver(device)

# If an extra plugin is requested, add a global flag to load the plugin
# and create the driver using the non-caching creation function, as
# the caching creation function may ignore the flag.
if extra_plugin:
ireert.flags.parse_flags(f"--executable_plugin={extra_plugin}")
haldriver = create_hal_driver(device)

# No plugin requested: create the driver with the caching create
# function.
else:
haldriver = ireert.get_driver(device)
if "://" in device:
try:
device_idx = int(device.split("://")[-1])
Expand Down
Loading