Skip to content

Implement a simple synchronous local HAL scheduling (sibling to task_*) #4680

Closed

Description

@benvanik

Systems that have a single processor don't need the fancy task system - they just need a way to run through simple commands kept in a command buffer. Ideally really small systems would compile away all of the HAL but it's a much smaller investment (and keeps code portable) to have a lightweight local-execution HAL backend that just runs synchronously.

This would be similar in nature to what existed before with the async_command_queue (which was async from the host perspective but synchronous from the device perspective) but much much simpler. It's intended for when the host and device are in the same binary/process/bare - in cases where there's a host/device split (no shared memory/independent versioning/different processes/etc) something more involved is required.

Activity

  1. self-assigned this
    on Feb 1, 2021
  2. added
    hal/cpu
    on Feb 1, 2021
  3. benvanik commented on Apr 8, 2021

    @benvanik
    CollaboratorAuthor

    The old C++ command buffer stuff lives here:
    https://github.com/google/iree/blob/2d534397009fb2bc8189c540799be1084c15499b/iree/hal/host/inproc_command_buffer.h#L205
    https://github.com/google/iree/blob/2d534397009fb2bc8189c540799be1084c15499b/iree/hal/host/inproc_command_buffer.cc#L125-L138

    This could be made much more efficient; a new version should use iree/hal/local/arena.h for storage and not record any recording-only state (push constants/descriptor sets/etc). The iree/hal/local/task_command_buffer.c does this and only actually commands are recorded. Even that could be made more memory efficient by slicing out the state tracking storage from the block pool and returning it after the iree_hal_command_buffer_end such that only the recorded storage persists.

    Unlike in the task system-based one above since this would be unthreaded there's no need to pay attention to any barriers - all commands will execute in the order they are recorded.

  4. added
    platform/generic 🔩
    on Apr 18, 2021
  5. benvanik commented on Apr 18, 2021

    @benvanik
    CollaboratorAuthor

    Some of the plumbing and the starting point is being done as part of #5508. The big work here (and what is mentioned above) is to add support for command buffer recording and explore pre-compiled command buffers (where we encode a binary structure in the compiler and load it at runtime without needing to issue the VM/HAL calls).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

hal/cpuplatform/generic 🔩

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions