Skip to content

Add hal_inline dialect/module for tiny environments. #9549

Closed

Description

@benvanik

For environments where the execution model is known to be exclusively local and inline (embedded systems) we can have a paired down HAL that pretty much only contains executable support. The idea is to still use HAL executable translation in the compiler but lowering the stream dialect to a new lightweight dialect that pretty much only manages executables and dispatches. Most of the local/ implementation of the executable loader and the loaders themselves have no dependencies on command buffers, allocators, buffers, or devices and can be cleanly pulled into the module without bringing in the bulk of the HAL API.

It's debatable whether the allocator/buffer stuff should be included - that would allow the coming allocator types to be reused but at the cost of additional non-user-controllable overheads. Since the local executables take byte spans all buffers could just be iree_vm_buffer_t which is already compiled in and available for use - and since they take a custom iree_allocator_t it's still possible for hosting applications to manage memory however they want.

Executables themselves will still be injected on the module when created same as today, allowing for dynamic, static, vmvx, etc executables to be run this way. This allows us to separate the execution model from the deployment model at the cost of a few vtables.

Outline:

  • Add hal_inline dialect with basic ops:
    • hal_inline.executable.create
    • hal_inline.executable.dispatch
    • hal_inline.executable_layout.create? (still need this to reuse loaders/libraries)
  • Add --execution-mode= iree-compile flag to switch between hal-async and hal-inline (or w/e)
    • Have a new iree-hal-inline-transformation-pipeline that still performs interface materialization and executable translation but otherwise lowers stream itself
  • Add iree/modules/hal_inline runtime module that links directly against the iree/hal/local/ libraries
  • Build a runner tool that uses the inline module (or make iree-run-module/etc always support it with a flag)

(could also call this the inline dialect or something - it's still technically a HAL though as the executables being called are abstracted across hardware - can have CPU/FPGA/DSP/etc)

Activity

  1. added
    runtime
    performance ⚡
    on Jun 17, 2022
  2. self-assigned this
    on Jun 17, 2022
  3. moved this to Backlog in @benvanik 👻on Jun 17, 2022
  4. moved this to Available in IREEon Jun 28, 2022
  5. benvanik commented on Oct 24, 2022

    @benvanik
    CollaboratorAuthor

    Landed - can be enabled with --iree-execution-model=inline-static (VMVX only) or --iree-execution-model=inline-dynamic (any CPU backend).

  6. Repository owner moved this from Available to Done in IREEon Oct 24, 2022
  7. Repository owner moved this from Available to Done in IREE - ARCHIVED (do not update)on Oct 24, 2022
  8. Repository owner moved this from Backlog to Done in @benvanik 👻on Oct 24, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

performance ⚡runtime

Type

No type

Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions