Skip to content

Support extension op sets in the VM compiler and runtime for i64/f32/f64 #2574

Closed

Description

@benvanik

The idea is to mimic RISCV and allow extensions to the VM. Some examples are 64-bit integer support, floating point (both 32 and 64-bit), and fixed or variable-length vector ops. These can be implemented as prefix bytes in the primary 0-255 set so we can easily detect and conditionally support ops at runtime (similar to classic cpuid checks).

Major tasks:

  • Cleanup bytecode_dispatch.c to be more readable (prior to copypastaing it)
  • Refactor bytecode_dispatch.c to be just the dispatch loop and move dispatches to separate textual_hdrs
  • Define prefix ops in op table and wire up to bytecode_dispatch
  • Pick one set of ops to add and test the system (i64?) end-to-end
  • Add compiler option in VM transformation to support the various feature flags

Open design issue:
we need to know way up at the flow dialect what our supported types are for both host and device - or support synthesizing appropriate conversions (which can be complicated if multiple devices are involved). For now we can punt on this as we don't support mixed devices, and we can just assert that the VM target supports the same types as the HAL backend for tensors.

Activity

  1. added
    enhancement ➕
    runtime
    on Jul 19, 2020
  2. self-assigned this
    on Jul 19, 2020
  3. added this to the milestone on Jul 19, 2020
  4. benvanik commented on Jul 27, 2020

    @benvanik
    CollaboratorAuthor

    Update: progress happening here: https://github.com/google/iree/tree/benvanik-vm64-i64

    Most of the ops are now present on both the compiler and runtime sides. Major work remaining is making register allocation aware of 64-bit registers (which to start may just be appended to i32 registers instead of aliasing) and adding the compiler flags/verification for the i64 extension (and others).

  5. benvanik commented on Jul 30, 2020

    @benvanik
    CollaboratorAuthor

    Update; i64 PR out; std->vm is not implemented and I'll file an issue for that specifically, but after a follow-on CL that adds a compiler flag for enabling 64-bit support in the VM this should be completed at this level. Thankfully it's 95% of the work required to support i64, so future work on lowering into the 64-bit VM should be much easier for others to implement.

  6. benvanik commented on Jul 31, 2020

    @benvanik
    CollaboratorAuthor

    With #2742 I think the bulk of the work in the VM is complete. There's remaining work to be tracked in #2728 for actually lowering from source dialects (HAL, XLA, etc) into the VM dialect.

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

Metadata

Metadata

Assignees

Labels

enhancement ➕runtime

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions