diff --git a/.github/workflows/test_models.yml b/.github/workflows/test_models.yml index 5e62f68e1..b7facb903 100644 --- a/.github/workflows/test_models.yml +++ b/.github/workflows/test_models.yml @@ -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 diff --git a/models/turbine_models/model_runner.py b/models/turbine_models/model_runner.py index bdc81bcf8..a173f3166 100644 --- a/models/turbine_models/model_runner.py +++ b/models/turbine_models/model_runner.py @@ -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])