Skip to content

Instantly share code, notes, and snippets.

@stellaraccident
Created April 30, 2021 20:07
Show Gist options
  • Save stellaraccident/036bada8e6ef97545712612a5f99bb82 to your computer and use it in GitHub Desktop.
Save stellaraccident/036bada8e6ef97545712612a5f99bb82 to your computer and use it in GitHub Desktop.
vm.func @dict_nest(%arg0: !vm.list<?>, %arg1: !vm.ref<!hal.buffer_view>) -> !vm.list<?> attributes {iree.reflection = {iree.abi = "{\22a\22:[[\22sdict\22,[\22dict\22,[\22sdict\22,[\22a\22,[\22ndarray\22,\22f32
\22,1,16]],[\22b\22,[\22ndarray\22,\22f32\22,1,16]]]],[\22list\22,[\22slist\22,[\22ndarray\22,\22f32\22,1,16],[\22ndarray\22,\22f32\22,1,16]]]],[\22ndarray\22,\22f32\22,0]],\22r\22:[[\22sdict\22,[\22dict\22,[\22
sdict\22,[\22a\22,[\22ndarray\22,\22f32\22,1,16]],[\22b\22,[\22ndarray\22,\22f32\22,1,16]]]],[\22list\22,[\22slist\22,[\22ndarray\22,\22f32\22,1,16],[\22ndarray\22,\22f32\22,1,16]]]]],\22v\22:1}"}, ordinal = 1 :
i32} {
%c2 = vm.const.i32 2 : i32 {block_defined = ["%arg0", "%arg1", "%c1", "%c2", "%list", "%list_0", "%list_2", "%ref", "%ref_1", "%ref_3", "%ref_4", "%zero"], block_live = ["%arg0", "%c1", "%c2", "%list", "%lis
t_0", "%list_2", "%ref", "%ref_1", "%ref_3", "%ref_4", "%zero"], block_live_in = [], block_live_out = [], block_registers = ["r0", "r1"], live = ["%arg0", "%arg1", "%c2"], result_registers = ["i0"]}
%zero = vm.const.i32.zero : i32 {live = ["%arg0", "%c2", "%zero"], result_registers = ["i1"]}
%c1 = vm.const.i32 1 : i32 {live = ["%arg0", "%c1", "%c2", "%zero"], result_registers = ["i2"]}
%list = vm.list.alloc %c2 {live = ["%arg0", "%c1", "%c2", "%list", "%zero"], result_registers = ["r1"]} : (i32) -> !vm.list<?>
%list_0 = vm.list.get.ref %arg0, %zero {live = ["%arg0", "%c1", "%list", "%list_0", "%zero"], result_registers = ["r2"]} : (!vm.list<?>, i32) -> !vm.list<?>
%ref = vm.list.get.ref %list_0, %zero {live = ["%arg0", "%c1", "%list", "%list_0", "%ref", "%zero"], result_registers = ["r3"]} : (!vm.list<?>, i32) -> !vm.ref<tensor<16xf32>>
%ref_1 = vm.list.get.ref %list_0, %c1 {live = ["%arg0", "%c1", "%list", "%list_0", "%ref", "%ref_1", "%zero"], result_registers = ["r2"]} : (!vm.list<?>, i32) -> !vm.ref<tensor<16xf32>>
%list_2 = vm.list.get.ref %arg0, %c1 {live = ["%arg0", "%c1", "%list", "%list_2", "%ref", "%ref_1", "%zero"], result_registers = ["r0"]} : (!vm.list<?>, i32) -> !vm.list<?>
%ref_3 = vm.list.get.ref %list_2, %zero {live = ["%c1", "%list", "%list_2", "%ref", "%ref_1", "%ref_3", "%zero"], result_registers = ["r4"]} : (!vm.list<?>, i32) -> !vm.ref<tensor<16xf32>>
%ref_4 = vm.list.get.ref %list_2, %c1 {live = ["%c1", "%list", "%list_2", "%ref", "%ref_1", "%ref_3", "%ref_4", "%zero"], result_registers = ["r0"]} : (!vm.list<?>, i32) -> !vm.ref<tensor<16xf32>>
vm.list.set.ref %list, %zero, %ref {live = ["%c1", "%list", "%ref", "%ref_1", "%ref_3", "%ref_4", "%zero"]} : (!vm.list<?>, i32, !vm.ref<tensor<16xf32>>)
vm.list.set.ref %list, %c1, %ref_1 {live = ["%c1", "%list", "%ref_1", "%ref_3", "%ref_4", "%zero"]} : (!vm.list<?>, i32, !vm.ref<tensor<16xf32>>)
vm.list.set.ref %list, %zero, %list {live = ["%c1", "%list", "%ref_3", "%ref_4", "%zero"]} : (!vm.list<?>, i32, !vm.list<?>)
vm.list.set.ref %list, %zero, %ref_3 {live = ["%c1", "%list", "%ref_3", "%ref_4", "%zero"]} : (!vm.list<?>, i32, !vm.ref<tensor<16xf32>>)
vm.list.set.ref %list, %c1, %ref_4 {live = ["%c1", "%list", "%ref_4"]} : (!vm.list<?>, i32, !vm.ref<tensor<16xf32>>)
vm.list.set.ref %list, %c1, %list {live = ["%c1", "%list"]} : (!vm.list<?>, i32, !vm.list<?>)
vm.return {live = ["%list"]} %list : !vm.list<?>
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment