commit | af60bfbfeeffbc56fbf6cc41b6af12e0842edc4b | [log] [tgz] |
---|---|---|
author | Ben Vanik <ben.vanik@gmail.com> | Tue Mar 07 13:57:56 2023 -0800 |
committer | GitHub <noreply@github.com> | Tue Mar 07 13:57:56 2023 -0800 |
tree | fbd247244d2a686ff4a48c0ecb698f7a59455d24 | |
parent | 9a222ebbf78a1cd7c874bed4d1dbb19c0d8c2eca [diff] | |
parent | f998e600df29e682b71fdde880096babc1c6699d [diff] |
Adding state functionality to iree-run-trace and improving ergonomics. (#12534) In order to support executing pipelines where outputs of one call are passed into another the trace replay functionality has grown slightly closer to turing complete (and loops are definitely coming :) by obtaining input/output control, numpy npy file access, and a blackboard for temporary values. A test demonstrating the file format and some `--help` info has been added to `iree-run-trace` to at least have a reference not generated by python and ensure it mostly works. --- The new `!input.get`/`!input.take`/`!output.set`/`!output.push` macros can be used in any source sequence such as function call arguments. These will either get (assign semantics) or take (move semantics) a value from the input list and set or push a value to the output list. `iree-run-trace` now supports the same `--input=`/`--output=` flags as `iree-run-module` and they define the input/output handling for the whole trace pipeline as if calling a single function. ```yaml type: call function: module.fn # pass the first two `--input=` flag values and a constant args: - !input.take 0 - !input.take 1 - !hal.buffer_view 4xf32=0,1,2,3 # store the two results into `--output=` 0 and 1 (pushing) results: - !output.set 0 - !output.push ``` --- In addition to the input/output lists there's also a user-defined blackboard that provides storage for the duration of the trace. Slots can be set by using `!blackboard.set`/`!blackboard.push` on any target sequence such as function call results and later retrieved in any source sequence with `!blackboard.get`/`!blackboard.take`. ```yaml # save call results to the blackboard type: call function: module.return_two_things results: - !blackboard.push - !blackboard.push --- # load prior results from the blackboard type: call function: module.consume_three_things args: - !input.take 0 - !blackboard.take 0 - !blackboard.take 1 ``` --- The `--input=` and `--output=`-style works for pipeline-style traces while larger traces may need programmatic control over I/O and the blackboard. The `numpy_load` and `numpy_save` events have been added which allow for loading or saving one or more `arrays` to a .npy file `path`. This can be used to stream outputs during processing by using the `append: true` node when saving or sharding to different files. ```yaml # load blackboard slot 3 and 4 from a .npy file type: numpy_load path: input.npy arrays: - !blackboard.set 3 - !blackboard.set 4 --- # save a few arrays to a .npy file type: numpy_save path: output.npy append: false arrays: - !blackboard.get 3 - !input.get 0 - !hal.buffer_view 4xf32=0,1,2,3 ``` --- There's some helpers that'd be useful to add (enqueue/dequeue, pop, etc) that could make it easier to write more complex pipelines. The blackboard could also be changed to using a hash table so that string keys could be used instead of just ordinals. Fixes #12525. Fixes #12526.
IREE (Intermediate Representation Execution Environment, pronounced as “eerie”) is an MLIR-based end-to-end compiler and runtime that lowers Machine Learning (ML) models to a unified IR that scales up to meet the needs of the datacenter and down to satisfy the constraints and special considerations of mobile and edge deployments.
See our website for project details, user guides, and instructions on building from source.
IREE is still in its early phase. We have settled down on the overarching infrastructure and are actively improving various software components as well as project logistics. It is still quite far from ready for everyday use and is made available without any support at the moment. With that said, we welcome any kind of feedback on any communication channels!
See our website for more information.
IREE is licensed under the terms of the Apache 2.0 License with LLVM Exceptions. See LICENSE for more information.