)]}'
{
  "commit": "af60bfbfeeffbc56fbf6cc41b6af12e0842edc4b",
  "tree": "fbd247244d2a686ff4a48c0ecb698f7a59455d24",
  "parents": [
    "9a222ebbf78a1cd7c874bed4d1dbb19c0d8c2eca",
    "f998e600df29e682b71fdde880096babc1c6699d"
  ],
  "author": {
    "name": "Ben Vanik",
    "email": "ben.vanik@gmail.com",
    "time": "Tue Mar 07 13:57:56 2023 -0800"
  },
  "committer": {
    "name": "GitHub",
    "email": "noreply@github.com",
    "time": "Tue Mar 07 13:57:56 2023 -0800"
  },
  "message": "Adding state functionality to iree-run-trace and improving ergonomics. (#12534)\n\nIn order to support executing pipelines where outputs of one call are\r\npassed into another the trace replay functionality has grown slightly\r\ncloser to turing complete (and loops are definitely coming :) by\r\nobtaining input/output control, numpy npy file access, and a blackboard\r\nfor temporary values. A test demonstrating the file format and some\r\n`--help` info has been added to `iree-run-trace` to at least have a\r\nreference not generated by python and ensure it mostly works.\r\n\r\n---\r\n\r\nThe new `!input.get`/`!input.take`/`!output.set`/`!output.push` macros\r\ncan be used in any source sequence such as function call arguments.\r\nThese will either get (assign semantics) or take (move semantics) a\r\nvalue from the input list and set or push a value to the output list.\r\n`iree-run-trace` now supports the same `--input\u003d`/`--output\u003d` flags as\r\n`iree-run-module` and they define the input/output handling for the\r\nwhole trace pipeline as if calling a single function.\r\n\r\n```yaml\r\ntype: call\r\nfunction: module.fn\r\n# pass the first two `--input\u003d` flag values and a constant\r\nargs:\r\n- !input.take 0\r\n- !input.take 1\r\n- !hal.buffer_view 4xf32\u003d0,1,2,3\r\n# store the two results into `--output\u003d` 0 and 1 (pushing)\r\nresults:\r\n- !output.set 0\r\n- !output.push\r\n```\r\n\r\n---\r\n\r\nIn addition to the input/output lists there\u0027s also a user-defined\r\nblackboard that provides storage for the duration of the trace. Slots\r\ncan be set by using `!blackboard.set`/`!blackboard.push` on any target\r\nsequence such as function call results and later retrieved in any source\r\nsequence with `!blackboard.get`/`!blackboard.take`.\r\n\r\n```yaml\r\n# save call results to the blackboard\r\ntype: call\r\nfunction: module.return_two_things\r\nresults:\r\n- !blackboard.push\r\n- !blackboard.push\r\n---\r\n# load prior results from the blackboard\r\ntype: call\r\nfunction: module.consume_three_things\r\nargs:\r\n- !input.take 0\r\n- !blackboard.take 0\r\n- !blackboard.take 1\r\n```\r\n\r\n---\r\n\r\nThe `--input\u003d` and `--output\u003d`-style works for pipeline-style traces\r\nwhile larger traces may need programmatic control over I/O and the\r\nblackboard. The `numpy_load` and `numpy_save` events have been added\r\nwhich allow for loading or saving one or more `arrays` to a .npy file\r\n`path`. This can be used to stream outputs during processing by using\r\nthe `append: true` node when saving or sharding to different files.\r\n\r\n```yaml\r\n# load blackboard slot 3 and 4 from a .npy file\r\ntype: numpy_load\r\npath: input.npy\r\narrays:\r\n- !blackboard.set 3\r\n- !blackboard.set 4\r\n---\r\n# save a few arrays to a .npy file\r\ntype: numpy_save\r\npath: output.npy\r\nappend: false\r\narrays:\r\n- !blackboard.get 3\r\n- !input.get 0\r\n- !hal.buffer_view 4xf32\u003d0,1,2,3\r\n```\r\n\r\n---\r\n\r\nThere\u0027s some helpers that\u0027d be useful to add (enqueue/dequeue, pop, etc)\r\nthat could make it easier to write more complex pipelines. The\r\nblackboard could also be changed to using a hash table so that string\r\nkeys could be used instead of just ordinals.\r\n\r\nFixes #12525.\r\nFixes #12526.",
  "tree_diff": []
}
