Skip to content

Adding iree_hal_driver_create_device_by_path & co. - #9413

Merged
benvanik merged 1 commit into
mainfrom
benvanik-device-params
Jun 9, 2022
Merged

benvanik merged 1 commit into
mainfrom
benvanik-device-params

Conversation

@benvanik

@benvanik benvanik commented Jun 9, 2022

Copy link
Copy Markdown
Collaborator

This adds the plumbing for creating devices by path specs in addition
to creating them by driver-specific IDs. A helper was also added to
create by ordinal to simplify tools that want to expose devices in a
canonical form with other driver-specific tools.

The creation methods also gain the ability to pass in key-value pair
parameters. Drivers can now use these parameters to refine device
selection and configure the devices during creation. The entire driver
layer is optional so the extra string handling here is only in cases that
desire it, and for devices that have no properties (like local-sync) it
doesn't add a cost.

A helper that parses a canonical device URI into the components for
create_device_by_path was added as iree_hal_driver_create_device_by_uri
and should be used by most hosting applications. For tooling and other
one-shot situations an even more convienient iree_hal_create_device is
added as an easy way to create devices with a massive footgun attached.
This may explode when using multiple devices or recreating devices; the
solution there is for the hosting application to create and cache the
drivers it wants to ensure remain around.

Progress on #9343.

@benvanik benvanik added hal/api IREE's public C hardware abstraction layer API runtime/tools IREE's runtime tooling (iree-run-module, iree-benchmark-module, etc) labels Jun 9, 2022
@benvanik
benvanik requested a review from ScottTodd June 9, 2022 15:20
Comment thread runtime/src/iree/hal/driver.h Resolved
Comment thread runtime/src/iree/hal/cts/driver_test.h Resolved
Comment thread runtime/src/iree/tools/utils/vm_util.h Resolved
Comment thread runtime/src/iree/hal/driver.h Resolved
This adds the plumbing for creating devices by path specs in addition
to creating them by driver-specific IDs. A helper was also added to
create by ordinal to simplify tools that want to expose devices in a
canonical form with other driver-specific tools.

The creation methods also gain the ability to pass in key-value pair
parameters. Drivers can now use these parameters to refine device
selection and configure the devices during creation. The entire driver
layer is optional so the extra string handling here is only in cases that
desire it, and for devices that have no properties (like local-sync) it
doesn't add a cost.

A helper that parses a canonical device URI into the components for
create_device_by_path was added as iree_hal_driver_create_device_by_uri
and should be used by most hosting applications. For tooling and other
one-shot situations an even more convienient iree_hal_create_device is
added as an easy way to create devices with a massive footgun attached.
This may explode when using multiple devices or recreating devices; the
solution there is for the hosting application to create and cache the
drivers it wants to ensure remain around.

Progress on #9343.
@benvanik
benvanik force-pushed the benvanik-device-params branch from cd0fbe3 to 13bc27b Compare June 9, 2022 16:25
@benvanik
benvanik marked this pull request as ready for review June 9, 2022 16:25
@benvanik
benvanik requested review from ScottTodd and removed request for GMNGeoffrey, ThomasRaoux and antiagainst June 9, 2022 16:25
@benvanik
benvanik enabled auto-merge (squash) June 9, 2022 16:32
@benvanik
benvanik merged commit 3c0d84b into main Jun 9, 2022
@benvanik
benvanik deleted the benvanik-device-params branch June 9, 2022 17:03
jpienaar pushed a commit to jpienaar/iree that referenced this pull request Jun 10, 2022
This adds the plumbing for creating devices by path specs in addition
to creating them by driver-specific IDs. A helper was also added to
create by ordinal to simplify tools that want to expose devices in a
canonical form with other driver-specific tools.

The creation methods also gain the ability to pass in key-value pair
parameters. Drivers can now use these parameters to refine device
selection and configure the devices during creation. The entire driver
layer is optional so the extra string handling here is only in cases that
desire it, and for devices that have no properties (like local-sync) it
doesn't add a cost.

A helper that parses a canonical device URI into the components for
create_device_by_path was added as iree_hal_driver_create_device_by_uri
and should be used by most hosting applications. For tooling and other
one-shot situations an even more convienient iree_hal_create_device is
added as an easy way to create devices with a massive footgun attached.
This may explode when using multiple devices or recreating devices; the
solution there is for the hosting application to create and cache the
drivers it wants to ensure remain around.

Progress on iree-org#9343.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

hal/api IREE's public C hardware abstraction layer API runtime/tools IREE's runtime tooling (iree-run-module, iree-benchmark-module, etc)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants