Skip to content

Instantly share code, notes, and snippets.

View stellaraccident's full-sized avatar

Stella Laurenzo stellaraccident

  • Amd
  • Seattle Washington, US
View GitHub Profile
#loc1 = loc("basic_sample.py":13:0)
#loc6 = loc("/home/stella/src/iree-build/compiler-api/python_package/iree/compiler/dialects/iree_pydm/rtl/modules/booleans.py":16:0)
module @module {
func @return_arg(%arg0: i32 loc("basic_sample.py":13:0), %arg1: i32 loc("basic_sample.py":13:0), %arg2: i32 loc("basic_sample.py":13:0)) -> (i32, i32) {
%0 = iree.list.create : !iree.list<!iree.variant> loc(#loc1)
%1 = iree.list.create : !iree.list<!iree.variant> loc(#loc1)
%2 = iree.list.create : !iree.list<!iree.variant> loc(#loc1)
%3 = iree.list.create : !iree.list<!iree.variant> loc(#loc1)
%c2 = constant 2 : index loc(#loc1)
iree.list.resize %3, %c2 : !iree.list<!iree.variant> loc(#loc1)
// ./iree/tools/iree-translate --iree-hal-target-backends=cpu --iree-mlir-to-vm-bytecode-module ~/scratch/ireerepro.mlir > ~/scratch/returnif.vmfb
//
// @M.export_pyfunc
// def return_arg(a: int, b: int, c: int) -> int:
// if b:
// return a
// else:
// return c
// Should print (0, 1) but prints (0, 5)
module @module {
iree_pydm.func @return_arg(%arg0: !iree_pydm.integer, %arg1: !iree_pydm.integer, %arg2: !iree_pydm.integer) -> (!iree_pydm.exception_result, !iree_pydm.integer) attributes {arg_names = ["a", "b", "c"], cell_vars = [], free_vars = ["a", "b", "c"]} {
%a = alloc_free_var "a" -> !iree_pydm.free_var_ref
%c = alloc_free_var "c" -> !iree_pydm.free_var_ref
%b = alloc_free_var "b" -> !iree_pydm.free_var_ref
%0 = box %arg0 : !iree_pydm.integer -> !iree_pydm.object<!iree_pydm.integer>
store_var %a = %0 : !iree_pydm.free_var_ref, !iree_pydm.object<!iree_pydm.integer>
%1 = box %arg1 : !iree_pydm.integer -> !iree_pydm.object<!iree_pydm.integer>
store_var %b = %1 : !iree_pydm.free_var_ref, !iree_pydm.object<!iree_pydm.integer>
%2 = box %arg2 : !iree_pydm.integer -> !iree_pydm.object<!iree_pydm.integer>
module @module attributes {hal.device.targets = [#device_target_cpu]} {
vm.module public @module attributes {ordinal_counts = #vm.ordinal_counts<import_funcs = 0, export_funcs = 1, internal_funcs = 1, global_bytes = 0, global_refs = 0, rodatas = 0, rwdatas = 0>} {
vm.func private @return_arg(%arg0: i32) -> (i32, i32) attributes {ordinal = 0 : i32} {
%zero = vm.const.i32.zero : i32
%c2 = vm.const.i32 2 : i32
%c9 = vm.const.i32 9 : i32
%c1 = vm.const.i32 1 : i32
%c256 = vm.const.i32 256 : i32
%c-4 = vm.const.i32 -4 : i32
%list = vm.list.alloc %zero : (i32) -> !vm.list<?>
module {
module @booleans {
iree_pydm.func @pydmrtl$object_as_bool(%arg0: !iree_pydm.object) -> (!iree_pydm.exception_result, !iree_pydm.bool) attributes {arg_names = ["v"], cell_vars = [], free_vars = ["v"]} {
%0 = constant 8 : i64 -> !iree_pydm.integer
%1 = constant 1 : i64 -> !iree_pydm.integer
%2 = constant false -> !iree_pydm.bool
%3 = constant 9 : i64 -> !iree_pydm.integer
%4 = constant 0 : i64 -> !iree_pydm.integer
%5 = constant 10 : i64 -> !iree_pydm.integer
%6 = constant 0.000000e+00 : f64 -> !iree_pydm.real
module {
func @main(%arg0: tensor<1x50x1024xf32>) -> tensor<1x50x1024xf32> attributes {tf.entry_function = {inputs = "Placeholder", outputs = "ffn/projection/transpose_6"}} {
%0 = "tosa.const"() {value = dense<[[-0.606424093, -0.257068604, -0.861039459, 0.599411249], [-1.40011382, -0.714802205, -0.834389805, -0.70947653], [0.200624198, -0.309171468, 0.1557163, 0.0122365123], [0.974201858, -0.0861519798, -1.01052082, 0.793641865], [0.46980384, 0.977718114, -1.16083705, 1.39096498], [0.0763229355, 0.101014435, 0.729743123, 0.239240512], [-0.188968942, -1.7925849, -1.52064347, -0.491924822], [0.16679813, -1.3849684, -0.231052741, 0.388421297], [0.162655845, 0.174614832, -0.278692663, 0.444319904], [-0.271921933, 0.744492352, 0.488966912, 0.248902649], [0.126721114, 0.763294458, -0.459857017, -1.4220233], [0.39206174, -1.0173862, -1.52627277, -0.120210558], [0.267897397, 0.127397686, -1.79463243, 0.0738144368], [1.07101059, 0.714992702, 0.119871214, 0.461607963], [0.734783053, -1.70889008, -0.237300709, -0
# RUN: %PYTHON %s | iree-dialects-opt -split-input-file | FileCheck --enable-var-scope --dump-input-filter=all %s
from typing import List
from mlir.dialects.iree_pydm.importer import *
from mlir.dialects.iree_pydm.importer.test_util import *
from mlir.dialects import iree_pydm as d
from mlir import ir
0000000004df6000 V vtable for std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>
0000000004df6090 V vtable for std::__future_base::_State_baseV2
0000000004df6048 V vtable for std::__future_base::_Task_state_base<void ()>
0000000004df60c0 V vtable for std::__future_base::_Result<void>
0000000004df4ff8 V vtable for std::_Sp_counted_deleter<void*, void (*)(void*), std::allocator<void>, (__gnu_cxx::_Lock_policy)2>
0000000004df5fc8 V vtable for std::_Sp_counted_ptr_inplace<std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>, std::allocator<int>, (__gnu_cxx::_Lock_policy)2>
00000000050c6510 V vtable for std::_Sp_counted_ptr_inplace<std::map<std::pair<unsigned long, unsigned long>, std::pair<unsigned long, unsigned int>, std::less<std::pair<unsigned long, unsigned long> >, std::allocator<std::pair<std::pair<unsigned long, unsigned long> const, std::pair<unsigned long, unsigned int> > > >, std::allocator<std::map<std::pair<unsigned long, unsigned lo
// -----// IR Dump After FusionOfTensorOps //----- //
func @softmax__2x2x2x2x2x2x2__f32__uniform(%arg0: !hal.buffer_view) -> !hal.buffer_view attributes {iree.abi.stub, iree.reflection = {iree.abi = "{\22a\22:[[\22ndarray\22,\22f32\22,7,null,null,null,null,null,null,null]],\22r\22:[[\22ndarray\22,\22f32\22,7,null,null,null,null,null,null,null]],\22v\22:1}"}} {
%c6 = constant 6 : index
%c5 = constant 5 : index
%c4 = constant 4 : index
%c3 = constant 3 : index
%c2 = constant 2 : index
%c1 = constant 1 : index
%c0 = constant 0 : index
%cst = constant 0.000000e+00 : f32
// -----// IR Dump Before mlir::iree_integrations::TF::LowerGlobalTensors //----- //
module attributes {tf.versions = {bad_consumers = [], min_consumer = 12 : i32, producer = 779 : i32}, tf_saved_model.semantics} {
"tf_saved_model.global_tensor"() {is_mutable, sym_name = "__sm_node15__optimizer.iter", tf_saved_model.exported_names = [], type = tensor<i64>, value = dense<0> : tensor<i64>} : () -> ()
"tf_saved_model.global_tensor"() {sym_name = "__sm_node17__optimizer.learning_rate", tf_saved_model.exported_names = [], type = tensor<f32>, value = dense<0.00999999977> : tensor<f32>} : () -> ()
"tf_saved_model.global_tensor"() {is_mutable, sym_name = "__sm_node45__m.layer-3.layer-1.embeddings", tf_saved_model.exported_names = [], type = tensor<100x768xf32>, value = opaque<"_", "0xDEADBEEF"> : tensor<100x768xf32>} : () -> ()
"tf_saved_model.global_tensor"() {is_mutable, sym_name = "__sm_node46__m.layer-3.layer-3.embeddings", tf_saved_model.exported_names = [], type = tensor<512x768xf32>, value = opaque<"_